Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs In nfs_loadattrcache(), if checkalias() gives us a n...



details:   https://anonhg.NetBSD.org/src/rev/0416008d8f40
branches:  trunk
changeset: 508900:0416008d8f40
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sat Apr 21 21:35:53 2001 +0000

description:
In nfs_loadattrcache(), if checkalias() gives us a new vnode, lock it.  This
prevents us losing the locked state of the old vnode.

fvdl thinks the old vnode is certain to be locked at this point.  I've put in
a KASSERT to be on the safe side.

This seems to fix PR kern/12661.

diffstat:

 sys/nfs/nfs_subs.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (33 lines):

diff -r 179963f0e2fa -r 0416008d8f40 sys/nfs/nfs_subs.c
--- a/sys/nfs/nfs_subs.c        Sat Apr 21 21:10:41 2001 +0000
+++ b/sys/nfs/nfs_subs.c        Sat Apr 21 21:35:53 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_subs.c,v 1.93 2001/03/23 21:11:44 fvdl Exp $       */
+/*     $NetBSD: nfs_subs.c,v 1.94 2001/04/21 21:35:53 bjh21 Exp $      */
 
 /*
  * Copyright (c) 1989, 1993
@@ -1599,16 +1599,19 @@
                                 * Since the nfsnode does not have a lock, its
                                 * vnode lock has to be carried over.
                                 */
+                               /*
+                                * XXX is the old node sure to be locked here?
+                                */
+                               KASSERT(lockstatus(&vp->v_lock) ==
+                                   LK_EXCLUSIVE);
                                nvp->v_data = vp->v_data;
                                vp->v_data = NULL;
                                VOP_UNLOCK(vp, 0);
                                vp->v_op = spec_vnodeop_p;
                                vrele(vp);
                                vgone(vp);
-                               /*
-                                * XXX When nfs starts locking, we need to
-                                * lock the new node here.
-                                */
+                               lockmgr(&nvp->v_lock, LK_EXCLUSIVE,
+                                   &nvp->v_interlock);
                                /*
                                 * Reinitialize aliased node.
                                 */



Home | Main Index | Thread Index | Old Index