From owner-svn-src-head@FreeBSD.ORG Sun May 31 14:54:21 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 327AD106564A; Sun, 31 May 2009 14:54:21 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 06D188FC13; Sun, 31 May 2009 14:54:21 +0000 (UTC) (envelope-from kib@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 n4VEsK2u046759; Sun, 31 May 2009 14:54:20 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n4VEsK9s046758; Sun, 31 May 2009 14:54:20 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200905311454.n4VEsK9s046758@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 31 May 2009 14:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193173 - head/sys/fs/nullfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 31 May 2009 14:54:21 -0000 Author: kib Date: Sun May 31 14:54:20 2009 New Revision: 193173 URL: http://svn.freebsd.org/changeset/base/193173 Log: Do not drop vnode interlock in null_checkvp(). null_lock() verifies that v_data is not-null before calling NULLVPTOLOWERVP(), and dropping the interlock allows for reclaim to clean v_data and free the memory. While there, remove unneeded semicolons and convert the infinite loops to panics. I have a will to remove null_checkvp() altogether, or leave it as a trivial stub, but not now. Reported and tested by: pho Modified: head/sys/fs/nullfs/null_subr.c Modified: head/sys/fs/nullfs/null_subr.c ============================================================================== --- head/sys/fs/nullfs/null_subr.c Sun May 31 14:52:45 2009 (r193172) +++ head/sys/fs/nullfs/null_subr.c Sun May 31 14:54:20 2009 (r193173) @@ -269,20 +269,14 @@ null_hashrem(xp) #ifdef DIAGNOSTIC -#ifdef KDB -#define null_checkvp_barrier 1 -#else -#define null_checkvp_barrier 0 -#endif - struct vnode * null_checkvp(vp, fil, lno) struct vnode *vp; char *fil; int lno; { - int interlock = 0; struct null_node *a = VTONULL(vp); + #ifdef notyet /* * Can't do this check because vop_reclaim runs @@ -290,9 +284,8 @@ null_checkvp(vp, fil, lno) */ if (vp->v_op != null_vnodeop_p) { printf ("null_checkvp: on non-null-node\n"); - while (null_checkvp_barrier) /*WAIT*/ ; panic("null_checkvp"); - }; + } #endif if (a->null_lowervp == NULLVP) { /* Should never happen */ @@ -301,32 +294,24 @@ null_checkvp(vp, fil, lno) for (p = (u_long *) a, i = 0; i < 8; i++) printf(" %lx", p[i]); printf("\n"); - /* wait for debugger */ - while (null_checkvp_barrier) /*WAIT*/ ; panic("null_checkvp"); } - if (mtx_owned(VI_MTX(vp)) != 0) { - VI_UNLOCK(vp); - interlock = 1; - } - if (vrefcnt(a->null_lowervp) < 1) { + VI_LOCK_FLAGS(a->null_lowervp, MTX_DUPOK); + if (a->null_lowervp->v_usecount < 1) { int i; u_long *p; printf("vp = %p, unref'ed lowervp\n", (void *)vp); for (p = (u_long *) a, i = 0; i < 8; i++) printf(" %lx", p[i]); printf("\n"); - /* wait for debugger */ - while (null_checkvp_barrier) /*WAIT*/ ; panic ("null with unref'ed lowervp"); - }; - if (interlock != 0) - VI_LOCK(vp); + } + VI_UNLOCK(a->null_lowervp); #ifdef notyet printf("null %x/%d -> %x/%d [%s, %d]\n", NULLTOV(a), vrefcnt(NULLTOV(a)), a->null_lowervp, vrefcnt(a->null_lowervp), fil, lno); #endif - return a->null_lowervp; + return (a->null_lowervp); } #endif