--- //depot/vendor/freebsd_6/src/sys/fs/pseudofs/pseudofs_vncache.c 2005/07/07 01:32:03 +++ //depot/yahoo/ybsd_6/src/sys/fs/pseudofs/pseudofs_vncache.c 2006/10/31 15:17:15 @@ -110,27 +111,28 @@ { struct pfs_vdata *pvd; int error; + struct vnode *vp; /* * See if the vnode is in the cache. * XXX linear search is not very efficient. */ +retry: mtx_lock(&pfs_vncache_mutex); for (pvd = pfs_vncache; pvd; pvd = pvd->pvd_next) { if (pvd->pvd_pn == pn && pvd->pvd_pid == pid && pvd->pvd_vnode->v_mount == mp) { - if (vget(pvd->pvd_vnode, 0, curthread) == 0) { + vp = pvd->pvd_vnode; + VI_LOCK(vp); + mtx_unlock(&pfs_vncache_mutex); + if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, curthread) == 0) { ++pfs_vncache_hits; - *vpp = pvd->pvd_vnode; - mtx_unlock(&pfs_vncache_mutex); + *vpp = vp; /* XXX see comment at top of pfs_lookup() */ - cache_purge(*vpp); - vn_lock(*vpp, LK_RETRY | LK_EXCLUSIVE, - curthread); + cache_purge(vp); return (0); } - /* XXX if this can happen, we're in trouble */ - break; + goto retry; } } mtx_unlock(&pfs_vncache_mutex);