aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2007-01-09 18:04:58 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2007-01-09 18:04:58 +0000
commit87cfa2c01360f0fcfd7e8221281dfd64473797be (patch)
tree3d00be6a6c084d38df2d5bc780f23ce01af50efc /sys/fs
parent58bcc6f4adb69c231daf0aca9d80ae23c5243402 (diff)
Notes
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/pseudofs/pseudofs_vncache.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c
index 4ce29af704d5..e6961bdb46cd 100644
--- a/sys/fs/pseudofs/pseudofs_vncache.c
+++ b/sys/fs/pseudofs/pseudofs_vncache.c
@@ -109,28 +109,29 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp,
struct pfs_node *pn, pid_t pid)
{
struct pfs_vdata *pvd;
+ struct vnode *vp;
int error;
/*
* 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);