macos bulkstat don't double reget refs
authorDerrick Brashear <shadow@dementia.org>
Sun, 18 Apr 2010 17:45:51 +0000 (13:45 -0400)
committerDerrick Brashear <shadow@dementia.org>
Mon, 19 Apr 2010 18:07:49 +0000 (11:07 -0700)
if another code path already got back the refs from finalizevnode,
don't do it again

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

src/afs/VNOPS/afs_vnop_lookup.c

index 06a79e9..6dbd070 100644 (file)
@@ -1261,20 +1261,27 @@ afs_DoBulkStat(struct vcache *adp, long dirCookie, struct vrequest *areqp)
            tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */ );
            ReleaseReadLock(&afs_xvcache);
        } while (tvcp && retry);
-       if (tvcp != NULL && (tvcp->f.states & CBulkFetching)
-           && (tvcp->f.m.Length == statSeqNo)) {
-           tvcp->f.states &= ~CBulkFetching;
-       }
        if (tvcp != NULL) {
-#ifdef AFS_DARWIN80_ENV            
-           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));
-           }
+           if ((tvcp->f.states & CBulkFetching)
+               && (tvcp->f.m.Length == statSeqNo)) {
+               tvcp->f.states &= ~CBulkFetching;
+#ifdef AFS_DARWIN80_ENV
+               if ((!(tvcp->f.states & CDeadVnode)&&!(tvcp->f.states & CVInit))) {
+                   /* re-acquire the io&usecount that finalizevnode dropped */
+                   vnode_get(AFSTOV(tvcp));
+                   vnode_ref(AFSTOV(tvcp));
+               }
 #endif
+           }
            afs_PutVCache(tvcp);
        }
+#ifdef AFS_DARWIN80_ENV            
+       else {
+           if ((!(tvcp->f.states & CDeadVnode)&&!(tvcp->f.states & CVInit)))
+               osi_Panic("vnode finalized without clearing BulkFetching!");
+       }
+#endif
+
     }
     if (volp)
        afs_PutVolume(volp, READ_LOCK);