diff options
author | jeff <jeff@FreeBSD.org> | 2002-07-08 01:50:14 +0000 |
---|---|---|
committer | jeff <jeff@FreeBSD.org> | 2002-07-08 01:50:14 +0000 |
commit | ce302369fbc64b2aa6f88338e81f3b1b823e19c9 (patch) | |
tree | 7decaf3e7f03a441cd6eea5eb2608db8dad3e7b6 /sys/fs/pseudofs/pseudofs_vncache.c | |
parent | c6f71d2a1d2a024e553871e2c8c17f8ab360ce66 (diff) | |
download | FreeBSD-src-ce302369fbc64b2aa6f88338e81f3b1b823e19c9.zip FreeBSD-src-ce302369fbc64b2aa6f88338e81f3b1b823e19c9.tar.gz |
Lock down pseudofs:
- Initialize lock structure in vncache_alloc
- Return locked vnodes from vncache_alloc
- Setup vnode op vectors to use default lock, unlock, and islocked
- Implement simple locking scheme required for lookup
Diffstat (limited to 'sys/fs/pseudofs/pseudofs_vncache.c')
-rw-r--r-- | sys/fs/pseudofs/pseudofs_vncache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 5f21d67..498de38 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -120,6 +120,8 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, mtx_unlock(&pfs_vncache_mutex); /* XXX see comment at top of pfs_lookup() */ cache_purge(*vpp); + vn_lock(*vpp, LK_RETRY | LK_EXCLUSIVE, + curthread); return (0); } /* XXX if this can happen, we're in trouble */ @@ -171,6 +173,9 @@ pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, pvd->pvd_next->pvd_prev = pvd; pfs_vncache = pvd; mtx_unlock(&pfs_vncache_mutex); + (*vpp)->v_vnlock = &(*vpp)->v_lock; + lockinit((*vpp)->v_vnlock, PINOD, "pfsnod", VLKTIMEOUT, LK_CANRECURSE); + vn_lock(*vpp, LK_RETRY | LK_EXCLUSIVE, curthread); return (0); } |