Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Probable fix for PR7943: lookups fail spuriously ov...



details:   https://anonhg.NetBSD.org/src/rev/86522dfcc609
branches:  trunk
changeset: 475014:86522dfcc609
user:      sommerfeld <sommerfeld%NetBSD.org@localhost>
date:      Thu Jul 29 13:31:45 1999 +0000

description:
Probable fix for PR7943: lookups fail spuriously over NFS.

The problem was due to an interaction between the doomed unmounts done by
amd and getnewvnode.
I convinced myself that it's ok for getnewvnode() to do a sleeping vfs_busy().

Tested with multiple builds running while another process attempted to unmount
/usr once a second.

diffstat:

 sys/kern/vfs_subr.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (41 lines):

diff -r 5375c0759116 -r 86522dfcc609 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Thu Jul 29 10:37:12 1999 +0000
+++ b/sys/kern/vfs_subr.c       Thu Jul 29 13:31:45 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.105 1999/07/15 21:30:31 wrstuden Exp $  */
+/*     $NetBSD: vfs_subr.c,v 1.106 1999/07/29 13:31:45 sommerfeld Exp $        */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -211,7 +211,8 @@
                 * wakeup needs to be done is at the release of the
                 * exclusive lock at the end of dounmount.
                 *
-                * XXX MP: add spinlock protecting mnt_wcnt here.
+                * XXX MP: add spinlock protecting mnt_wcnt here once you
+                * can atomically unlock-and-sleep.
                 */
                mp->mnt_wcnt++;
                sleep((caddr_t)mp, PVFS);
@@ -410,13 +411,15 @@
 #endif
        if (mp) {
                /*
-                * XXX
-                * calling vfs_busy here (either with or without LK_NOWAIT)
-                * means that syscalls taking place during an
-                * unsuccessful unmount attempt will fail (spuriously).
-                * We should be able to wait for the unmount to finish.
+                * Mark filesystem busy while we're creating a vnode.
+                * If unmount is in progress, this will wait; if the
+                * unmount succeeds (only if umount -f), this will
+                * return an error.  If the unmount fails, we'll keep
+                * going afterwards.
+                * (This puts the per-mount vnode list logically under
+                * the protection of the vfs_busy lock).
                 */
-               error = vfs_busy(mp, LK_NOWAIT, 0);
+               error = vfs_busy(mp, 0, 0);
                if (error)
                        return error;
        }



Home | Main Index | Thread Index | Old Index