svn commit: r193556 - head/sys/fs/pseudofs
Dag-Erling Smorgrav
des at FreeBSD.org
Sat Jun 6 00:44:14 UTC 2009
Author: des
Date: Sat Jun 6 00:44:13 2009
New Revision: 193556
URL: http://svn.freebsd.org/changeset/base/193556
Log:
Drop Giant.
MFC after: 1 week
Modified:
head/sys/fs/pseudofs/pseudofs_vncache.c
Modified: head/sys/fs/pseudofs/pseudofs_vncache.c
==============================================================================
--- head/sys/fs/pseudofs/pseudofs_vncache.c Sat Jun 6 00:38:15 2009 (r193555)
+++ head/sys/fs/pseudofs/pseudofs_vncache.c Sat Jun 6 00:44:13 2009 (r193556)
@@ -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);
}
More information about the svn-src-head
mailing list