From f90a3a5b19bb4a8da91f0cbbcb4957c2d8246bcf Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Fri, 25 Feb 2011 16:01:32 -0600 Subject: [PATCH] DAFS: VnLock after VnWaitQuiescent in VAllocVnode In VAllocVnode, we write-lock the newly-allocated vnode. In DAFS, however, we need to VnWaitQuiescent_r before VnLock'ing, since VnLock in DAFS just sets the writer tid/pid. So, in VAllocVnode, move the VnLock call to after we wait for quiescence, so we don't stomp over the vnode when someone else has it write-locked. Reviewed-on: http://gerrit.openafs.org/4059 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Derrick Brashear (cherry picked from commit b41575d176c2d485d55aed8780bfab9db4b7587d) Change-Id: I6c3d68f0f5248308d0f32e9fad5c540aaf593962 Reviewed-on: http://gerrit.openafs.org/4169 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/vol/vnode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vol/vnode.c b/src/vol/vnode.c index c453409c3..3687a1b2c 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -666,9 +666,6 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type) /* This won't block */ VnLock(vnp, WRITE_LOCK, VOL_LOCK_HELD, WILL_NOT_DEADLOCK); } else { - /* other users present; follow locking hierarchy */ - VnLock(vnp, WRITE_LOCK, VOL_LOCK_HELD, MIGHT_DEADLOCK); - #ifdef AFS_DEMAND_ATTACH_FS /* * DAFS: @@ -686,6 +683,9 @@ VAllocVnode_r(Error * ec, Volume * vp, VnodeType type) } #endif + /* other users present; follow locking hierarchy */ + VnLock(vnp, WRITE_LOCK, VOL_LOCK_HELD, MIGHT_DEADLOCK); + /* * verify state of the world hasn't changed * -- 2.39.5