From owner-svn-src-stable@FreeBSD.ORG Wed Jun 17 14:50:42 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 337081065686; Wed, 17 Jun 2009 14:50:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 084108FC15; Wed, 17 Jun 2009 14:50:42 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5HEof2m078971; Wed, 17 Jun 2009 14:50:41 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5HEofB5078969; Wed, 17 Jun 2009 14:50:41 GMT (envelope-from des@svn.freebsd.org) Message-Id: <200906171450.n5HEofB5078969@svn.freebsd.org> From: Dag-Erling Smorgrav Date: Wed, 17 Jun 2009 14:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194367 - in stable/7/sys: . contrib/pf dev/ath/ath_hal fs/pseudofs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2009 14:50:42 -0000 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); }