do {
retry = 0;
ObtainReadLock(&afs_xvcache);
- tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */ );
+ tvcp = afs_FindVCache(&afid, &retry, FIND_CDEAD /* !stats&!lru */);
ReleaseReadLock(&afs_xvcache);
} while (tvcp && retry);
* file. Leave the entry alone.
*/
if (!(tvcp->f.states & CBulkFetching) || (tvcp->f.m.Length != statSeqNo)) {
-#ifdef AFS_DARWIN80_ENV
- int isdead = ((tvcp->f.states & CDeadVnode) ||
- (tvcp->f.states & CVInit));
-#endif
flagIndex++;
ReleaseWriteLock(&tvcp->lock);
-#ifdef AFS_DARWIN80_ENV
- 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;
}
*/
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 io&usecount that the other finalizevnode disposed of */
- vnode_get(AFSTOV(tvcp));
- vnode_ref(AFSTOV(tvcp));
- }
-#endif
ReleaseWriteLock(&tvcp->lock);
ReleaseWriteLock(&afs_xcbhash);
afs_PutVCache(tvcp);
if ((tvcp->f.states & CForeign) || (vType(tvcp) == VDIR))
osi_dnlc_purgedp(tvcp); /* if it (could be) a directory */
}
- ReleaseWriteLock(&afs_xcbhash);
#ifdef AFS_DARWIN80_ENV
/* reclaim->FlushVCache will need xcbhash */
if (((tvcp->f.states & CDeadVnode)||(tvcp->f.states & CVInit))) {
+ ReleaseWriteLock(&afs_xcbhash);
/* passing in a parent hangs getting the vnode lock */
code = afs_darwin_finalizevnode(tvcp, NULL, NULL, 0, 1);
if (code) {
if ((tvcp->f.states & CForeign) || (vType(tvcp) == VDIR))
osi_dnlc_purgedp(tvcp); /* if it (could be) a directory */
} else {
- /* re-acquire the io&usecount that finalizevnode disposed of */
- vnode_get(AFSTOV(tvcp));
+ /* re-acquire the usecount that finalizevnode disposed of */
vnode_ref(AFSTOV(tvcp));
}
- }
+ } else
#endif
+ ReleaseWriteLock(&afs_xcbhash);
ReleaseWriteLock(&tvcp->lock);
/* finally, we're done with the entry */
do {
retry = 0;
ObtainReadLock(&afs_xvcache);
- tvcp = afs_FindVCache(&afid, &retry, 0 /* !stats&!lru */ );
+ tvcp = afs_FindVCache(&afid, &retry, FIND_CDEAD /* !stats&!lru */);
ReleaseReadLock(&afs_xvcache);
} while (tvcp && retry);
if (tvcp != NULL) {
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);
}
/* was: (AFS_DEC_ENV) || defined(AFS_OSF30_ENV) || defined(AFS_NCR_ENV) */
-#ifdef AFS_DARWIN_ENV
-static int AFSDOBULK = 0;
-#else
static int AFSDOBULK = 1;
-#endif
int
#if defined(AFS_SUN5_ENV) || defined(AFS_SGI_ENV)
static void
findvc_sleep(struct vcache *avc, int flag)
{
+ int fstates = avc->f.states;
if (flag & IS_SLOCK) {
ReleaseSharedLock(&afs_xvcache);
} else {
ReleaseReadLock(&afs_xvcache);
}
}
- afs_osi_Sleep(&avc->f.states);
+ if (flag & FIND_CDEAD) {
+ ObtainWriteLock(&afs_xvcache, 342);
+ afs_FlushReclaimedVcaches();
+ if (fstates == avc->f.states) {
+ ReleaseWriteLock(&afs_xvcache);
+ afs_osi_Sleep(&avc->f.states);
+ } else
+ ReleaseWriteLock(&afs_xvcache);
+ } else
+ afs_osi_Sleep(&avc->f.states);
if (flag & IS_SLOCK) {
ObtainSharedLock(&afs_xvcache, 341);
} else {
}
#ifdef AFS_DARWIN80_ENV
if (tvc->f.states & CDeadVnode) {
- if (!(tvc->f.states & CBulkFetching)) {
+ if (!(flag & FIND_CDEAD)) {
findvc_sleep(tvc, flag);
goto findloop;
}