svn commit: r194367 - in stable/7/sys: . contrib/pf dev/ath/ath_hal
fs/pseudofs
Dag-Erling Smorgrav
des at FreeBSD.org
Wed Jun 17 14:50:42 UTC 2009
Author: des
Date: Wed Jun 17 14:50:41 2009
New Revision: 194367
URL: http://svn.freebsd.org/changeset/base/194367
Log:
merge r193556: drop Giant from pseudofs.
Modified:
stable/7/sys/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
stable/7/sys/dev/ath/ath_hal/ (props changed)
stable/7/sys/fs/pseudofs/pseudofs_vncache.c
Modified: stable/7/sys/fs/pseudofs/pseudofs_vncache.c
==============================================================================
--- stable/7/sys/fs/pseudofs/pseudofs_vncache.c Wed Jun 17 14:47:06 2009 (r194366)
+++ stable/7/sys/fs/pseudofs/pseudofs_vncache.c Wed Jun 17 14:50:41 2009 (r194367)
@@ -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, curthread);
vgone(vnp);
VOP_UNLOCK(vnp, 0, curthread);
- 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);
}
More information about the svn-src-stable-7
mailing list