diff --git a/src/afs/DARWIN/osi_vnodeops.c b/src/afs/DARWIN/osi_vnodeops.c index 5d02274020..c3dc92c24a 100644 --- a/src/afs/DARWIN/osi_vnodeops.c +++ b/src/afs/DARWIN/osi_vnodeops.c @@ -1194,8 +1194,12 @@ afs_vop_remove(ap) cache_purge(vp); if (!error) { #ifdef AFS_DARWIN80_ENV - ubc_setsize(vp, (off_t)0); - vnode_recycle(vp); + struct vcache *tvc = VTOAFS(vp); + + if (!(tvc->states & CUnlinked)) { + ubc_setsize(vp, (off_t)0); + vnode_recycle(vp); + } #else /* necessary so we don't deadlock ourselves in vclean */ VOP_UNLOCK(vp, 0, cnp->cn_proc); @@ -1626,9 +1630,18 @@ afs_vop_inactive(ap) vprint("afs_vop_inactive(): pushing active", vp); #endif if (tvc) { - AFS_GLOCK(); - afs_InactiveVCache(tvc, 0); /* decrs ref counts */ - AFS_GUNLOCK(); +#ifdef AFS_DARWIN80_ENV + int unlinked = tvc->states & CUnlinked; +#endif + AFS_GLOCK(); + afs_InactiveVCache(tvc, 0); /* decrs ref counts */ + AFS_GUNLOCK(); +#ifdef AFS_DARWIN80_ENV + if (unlinked) { + vnode_recycle(vp); + cache_purge(vp); + } +#endif } #ifndef AFS_DARWIN80_ENV VOP_UNLOCK(vp, 0, ap->a_p);