]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
FBSD: band-aid vnode locking in lookup
authorBen Kaduk <kaduk@mit.edu>
Sun, 24 Oct 2010 04:29:07 +0000 (00:29 -0400)
committerDerrick Brashear <shadow@dementia.org>
Mon, 10 Jan 2011 04:28:26 +0000 (20:28 -0800)
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 <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-on: http://gerrit.openafs.org/3632
Tested-by: Derrick Brashear <shadow@dementia.org>
src/afs/FBSD/osi_vnodeops.c

index 234668ac47a597079f2c4bc58502514e24daaa1d..7ae6571adb74d69cfe25e3190ade3b22dc8cdab8 100644 (file)
@@ -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))) {