From 2f6be821ffeba607d4305586ad2c7ec4ba2b180c Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Sun, 24 Oct 2010 00:29:07 -0400 Subject: [PATCH] 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: Ie99a677978370488f8edc7128014b89abc00a56c Reviewed-on: http://gerrit.openafs.org/3035 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/afs/FBSD/osi_vnodeops.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/afs/FBSD/osi_vnodeops.c b/src/afs/FBSD/osi_vnodeops.c index cbd94d797..521564262 100644 --- a/src/afs/FBSD/osi_vnodeops.c +++ b/src/afs/FBSD/osi_vnodeops.c @@ -531,7 +531,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))) { -- 2.39.5