From: Ben Kaduk Date: Sun, 24 Oct 2010 04:29:07 +0000 (-0400) Subject: FBSD: band-aid vnode locking in lookup X-Git-Tag: upstream/1.6.0.pre2^2~162 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=0f48add85f29de63eeaf1d6342f675131dc4ab79;p=packages%2Fo%2Fopenafs.git FBSD: band-aid vnode locking in lookup The lock order requires that we acquire vnode locks from the root towards the leaf. When looking up "..", this requires that we unlock the directory before locking the child, otherwise we are susceptible to deadlock. This is only a band-aid, as afs_vop_lookup should be rewritten. Change-Id: I594f31ba05c3847e5d83d89748266d24547bf97b Reviewed-on: http://gerrit.openafs.org/3035 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-on: http://gerrit.openafs.org/3632 Tested-by: Derrick Brashear --- diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index 234668ac4..7ae6571ad 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -533,7 +533,9 @@ afs_vop_lookup(ap) * we also always return the vnode locked. */ if (flags & ISDOTDOT) { + MA_VOP_UNLOCK(dvp, 0, p); ma_vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); + ma_vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, p); /* always return the child locked */ if (lockparent && (flags & ISLASTCN) && (error = ma_vn_lock(dvp, LK_EXCLUSIVE, p))) {