darwin bulk race needs an iocount
authorDerrick Brashear <shadow@dementia.org>
Thu, 15 Apr 2010 04:13:43 +0000 (00:13 -0400)
committerDerrick Brashear <shadow@dementia.org>
Thu, 15 Apr 2010 17:39:14 +0000 (10:39 -0700)
if another user raced with us, we need an iocount back since finalize
will have dropped one.

Change-Id: I93b2bb5b6004b39436684e78c4620f4d7d9d0c8e
Reviewed-on: http://gerrit.openafs.org/1756
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/afs/VNOPS/afs_vnop_lookup.c

index e0db9ae..40d0f31 100644 (file)
@@ -1082,9 +1082,11 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
            flagIndex++;
            ReleaseWriteLock(&tvcp->lock);
 #ifdef AFS_DARWIN80_ENV            
-           if (!isdead)
-               /* re-acquire the usecount that the other finalizevnode disposed of */
+           if (!isdead) {
+               /* re-acquire the io&usecount that the other finalizevnode disposed of */
+               vnode_get(AFSTOV(tvcp));
                vnode_ref(AFSTOV(tvcp));
+           }
 #endif
            afs_PutVCache(tvcp);
            continue;
@@ -1142,9 +1144,11 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
        if (!(tvcp->f.states & CBulkFetching) || (tvcp->f.m.Length != statSeqNo)) {
            flagIndex++;
 #ifdef AFS_DARWIN80_ENV            
-           if ((!(tvcp->f.states & CDeadVnode)&&!(tvcp->f.states & CVInit)))
-               /* re-acquire the usecount that the other finalizevnode disposed of */
+           if ((!(tvcp->f.states & CDeadVnode)&&!(tvcp->f.states & CVInit))) {
+               /* re-acquire the io&usecount that the other finalizevnode disposed of */
+               vnode_get(AFSTOV(tvcp));
                vnode_ref(AFSTOV(tvcp));
+           }
 #endif
            ReleaseWriteLock(&tvcp->lock);
            ReleaseWriteLock(&afs_xcbhash);
@@ -1214,9 +1218,11 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
                afs_DequeueCallback(tvcp);
                if ((tvcp->f.states & CForeign) || (vType(tvcp) == VDIR))
                    osi_dnlc_purgedp(tvcp); /* if it (could be) a directory */
-           } else
-               /* re-acquire the usecount that finalizevnode disposed of */
+           } else {
+               /* re-acquire the io&usecount that finalizevnode disposed of */
+               vnode_get(AFSTOV(tvcp));
                vnode_ref(AFSTOV(tvcp));
+           }
        }
 #endif
 
@@ -1256,9 +1262,11 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
        }
        if (tvcp != NULL) {
 #ifdef AFS_DARWIN80_ENV            
-           if ((!(tvcp->f.states & CDeadVnode)&&!(tvcp->f.states & CVInit)))
-               /* re-acquire the usecount that the other finalizevnode disposed of */
+           if ((!(tvcp->f.states & CDeadVnode)&&!(tvcp->f.states & CVInit))) {
+               /* re-acquire the io&usecount that the other finalizevnode disposed of */
+               vnode_get(AFSTOV(tvcp));
                vnode_ref(AFSTOV(tvcp));
+           }
 #endif
            afs_PutVCache(tvcp);
        }