Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/coda fix a deadlock during mount:



details:   https://anonhg.NetBSD.org/src/rev/bbba0792b63a
branches:  trunk
changeset: 550917:bbba0792b63a
user:      drochner <drochner%NetBSD.org@localhost>
date:      Mon Aug 25 10:05:46 2003 +0000

description:
fix a deadlock during mount:
The client manager (venus) blocks in sys_mount() before entering its
event loop answering requests from the kernel device (cfs). sys_mount()
calls VFS_STATFS() internally which caused an upcall through cfs,
which was never answered.
Now don't consider the fs fully mounted before the VFS_START() was
called at the vey end of sys_mount(). So VFS_STATFS() will return
an error which is ignored.

diffstat:

 sys/coda/cnode.h       |  6 ++++--
 sys/coda/coda_vfsops.c |  7 +++++--
 2 files changed, 9 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r 2672240ea76a -r bbba0792b63a sys/coda/cnode.h
--- a/sys/coda/cnode.h  Mon Aug 25 09:24:53 2003 +0000
+++ b/sys/coda/cnode.h  Mon Aug 25 10:05:46 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cnode.h,v 1.11 2003/02/02 02:34:54 christos Exp $      */
+/*     $NetBSD: cnode.h,v 1.12 2003/08/25 10:05:47 drochner Exp $      */
 
 /*
  * 
@@ -154,6 +154,7 @@
     struct vnode       *mi_rootvp;
     struct mount       *mi_vfsp;
     struct vcomm        mi_vcomm;
+    int                         mi_started;    
 };
 extern struct coda_mntinfo coda_mnttbl[]; /* indexed by minor device number */
 
@@ -161,7 +162,8 @@
  * vfs pointer to mount info
  */
 #define vftomi(vfsp)    ((struct coda_mntinfo *)(vfsp->mnt_data))
-#define        CODA_MOUNTED(vfsp)   (vftomi((vfsp)) != (struct coda_mntinfo *)0)
+#define        CODA_MOUNTED(vfsp)   ((vftomi(vfsp) != (struct coda_mntinfo *)0) \
+       && (vftomi(vfsp)->mi_started))
 
 /*
  * vnode pointer to mount info
diff -r 2672240ea76a -r bbba0792b63a sys/coda/coda_vfsops.c
--- a/sys/coda/coda_vfsops.c    Mon Aug 25 09:24:53 2003 +0000
+++ b/sys/coda/coda_vfsops.c    Mon Aug 25 10:05:46 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_vfsops.c,v 1.27 2003/08/25 09:24:53 drochner Exp $        */
+/*     $NetBSD: coda_vfsops.c,v 1.28 2003/08/25 10:05:46 drochner Exp $        */
 
 /*
  * 
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.27 2003/08/25 09:24:53 drochner Exp $");
+__KERNEL_RCSID(0, "$NetBSD: coda_vfsops.c,v 1.28 2003/08/25 10:05:46 drochner Exp $");
 
 #ifdef _LKM
 #define        NVCODA 4
@@ -278,6 +278,7 @@
     struct proc *p;
 {
     ENTRY;
+    vftomi(vfsp)->mi_started = 1;
     return (0);
 }
 
@@ -304,6 +305,8 @@
 #ifdef DEBUG
        printf("coda_unmount: ROOT: vp %p, cp %p\n", mi->mi_rootvp, VTOC(mi->mi_rootvp));
 #endif
+       mi->mi_started = 0;
+
        vrele(mi->mi_rootvp);
 
        active = coda_kill(vfsp, NOT_DOWNCALL);



Home | Main Index | Thread Index | Old Index