From b41575d176c2d485d55aed8780bfab9db4b7587d 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. Change-Id: Ib234634dba9d09eea877bc91660ea3a8a4e2b746 Reviewed-on: http://gerrit.openafs.org/4059 Tested-by: BuildBot Reviewed-by: Michael Meffie 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 3c10baa..532fe83 100644 --- a/src/vol/vnode.c +++ b/src/vol/vnode.c @@ -669,9 +669,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: @@ -689,6 +686,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 * -- 1.9.4