]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE12-darwin-vnops-make-unlink-fix-fake-references-20020422
authorChaskiel M Grundman <cg2v@andrew.cmu.edu>
Mon, 22 Apr 2002 17:06:36 +0000 (17:06 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 22 Apr 2002 17:06:36 +0000 (17:06 +0000)
so unlink doesn't panic us

(cherry picked from commit 6d43ab450a907bb1eccf9561c37c108202cd8e52)

src/afs/VNOPS/afs_vnop_remove.c

index 3bdb16cfdab1f697c9d20537190a19035ef251d3..2dd60107dafa6bca1b753b15f6bdc69310e199be 100644 (file)
@@ -415,6 +415,17 @@ afs_remunlink(avc, doit)
            cred = avc->uncred;
            avc->uncred = NULL;
 
+#ifdef AFS_DARWIN_ENV
+           /* this is called by vrele (via VOP_INACTIVE) when the refcount
+              is 0. we can't just call VN_HOLD since vref will panic.
+              we can't just call osi_vnhold because a later AFS_RELE will call
+              vrele again, which will try to call VOP_INACTIVE again after
+              vn_locking the vnode. which would be fine except that our vrele
+              caller also locked the vnode... So instead, we just gimmick the
+              refcounts and hope nobody else can touch the file now */
+           osi_Assert(VREFCOUNT(avc) == 0);
+           VREFCOUNT_SET(avc, 1);
+#endif
            VN_HOLD(&avc->v);
 
            /* We'll only try this once. If it fails, just release the vnode.
@@ -444,6 +455,10 @@ afs_remunlink(avc, doit)
            }
            osi_FreeSmallSpace(unlname);
            crfree(cred);
+#ifdef AFS_DARWIN_ENV
+           osi_Assert(VREFCOUNT(avc) == 1);
+           VREFCOUNT_SET(avc, 0);
+#endif
         }
     }
     else {