diff options
author | des <des@FreeBSD.org> | 2009-06-06 00:44:13 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2009-06-06 00:44:13 +0000 |
commit | 1e782303dec5a1467e980e58e8ba2cdfb54bacf7 (patch) | |
tree | 1ef9c8bb824228df01faae38d76472e56866b4b1 /sys/fs | |
parent | a0e4dc565d45f47975b84a1ed3ae34fa16eac43e (diff) | |
download | FreeBSD-src-1e782303dec5a1467e980e58e8ba2cdfb54bacf7.zip FreeBSD-src-1e782303dec5a1467e980e58e8ba2cdfb54bacf7.tar.gz |
Drop Giant.
MFC after: 1 week
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/pseudofs/pseudofs_vncache.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/sys/fs/pseudofs/pseudofs_vncache.c b/sys/fs/pseudofs/pseudofs_vncache.c index 551ae6a..3145870 100644 --- a/sys/fs/pseudofs/pseudofs_vncache.c +++ b/sys/fs/pseudofs/pseudofs_vncache.c @@ -270,13 +270,13 @@ pfs_vncache_free(struct vnode *vp) * The only way to improve this situation is to change the data structure * used to implement the cache. */ -void -pfs_purge(struct pfs_node *pn) +static void +pfs_purge_locked(struct pfs_node *pn) { struct pfs_vdata *pvd; struct vnode *vnp; - mtx_lock(&pfs_vncache_mutex); + mtx_assert(&pfs_vncache_mutex, MA_OWNED); pvd = pfs_vncache; while (pvd != NULL) { if (pvd->pvd_dead || (pn != NULL && pvd->pvd_pn == pn)) { @@ -286,22 +286,26 @@ pfs_purge(struct pfs_node *pn) VOP_LOCK(vnp, LK_EXCLUSIVE); vgone(vnp); VOP_UNLOCK(vnp, 0); - vdrop(vnp); mtx_lock(&pfs_vncache_mutex); + vdrop(vnp); pvd = pfs_vncache; } else { pvd = pvd->pvd_next; } } +} + +void +pfs_purge(struct pfs_node *pn) +{ + + mtx_lock(&pfs_vncache_mutex); + pfs_purge_locked(pn); mtx_unlock(&pfs_vncache_mutex); } /* * Free all vnodes associated with a defunct process - * - * XXXRW: It is unfortunate that pfs_exit() always acquires and releases two - * mutexes (one of which is Giant) for every process exit, even if procfs - * isn't mounted. */ static void pfs_exit(void *arg, struct proc *p) @@ -311,13 +315,11 @@ pfs_exit(void *arg, struct proc *p) if (pfs_vncache == NULL) return; - mtx_lock(&Giant); mtx_lock(&pfs_vncache_mutex); for (pvd = pfs_vncache, dead = 0; pvd != NULL; pvd = pvd->pvd_next) if (pvd->pvd_pid == p->p_pid) dead = pvd->pvd_dead = 1; - mtx_unlock(&pfs_vncache_mutex); if (dead) - pfs_purge(NULL); - mtx_unlock(&Giant); + pfs_purge_locked(NULL); + mtx_unlock(&pfs_vncache_mutex); } |