From nobody@FreeBSD.org  Wed Dec  2 02:49:59 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DBA191065670
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  2 Dec 2009 02:49:59 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id CB77D8FC1E
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  2 Dec 2009 02:49:59 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id nB22nx34027159
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 2 Dec 2009 02:49:59 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id nB22nx4Z027158;
	Wed, 2 Dec 2009 02:49:59 GMT
	(envelope-from nobody)
Message-Id: <200912020249.nB22nx4Z027158@www.freebsd.org>
Date: Wed, 2 Dec 2009 02:49:59 GMT
From: Gleb Kurtsou <gk@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] [nullfs] fix panics with DIAGNOSTIC enabled
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         141091
>Category:       kern
>Synopsis:       [patch] [nullfs] fix panics with DIAGNOSTIC enabled
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-fs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 02 03:00:12 UTC 2009
>Closed-Date:    
>Last-Modified:  Wed Dec 02 04:55:39 UTC 2009
>Originator:     Gleb Kurtsou
>Release:        
>Organization:
>Environment:
FreeBSD tops 9.0-CURRENT FreeBSD 9.0-CURRENT #25 r199870+0277b4f: Sat Nov 28 22:04:50 EET 2009     root@tops:/usr/obj/usr/freebsd-src/local/sys/TOPS  amd64
>Description:
null_checkvp function shouldn't be called from null_lock and null_unlock (through NULLVPTOLOWERVP(vp) macro)

null_lock and null_unlock code expects that some of "usual" assumptions on vnodes do not hold, e.g. during node creation and reclaim lower vnode can be null, etc.

example panic backtraces:

http://lists.freebsd.org/pipermail/freebsd-fs/2009-November/007176.html
>How-To-Repeat:
recompile kernel with
options INVARIANT_SUPPORT
options INVARIANTS
options DIAGNOSTIC 
>Fix:
disable vnode checks in null_lock and null_unlock

Patch attached with submission follows:

diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index a028b63..4c0679f 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -553,7 +553,7 @@ null_lock(struct vop_lock1_args *ap)
 	 * lock as ffs has special lock considerations in it's
 	 * vop lock.
 	 */
-	if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) {
+	if (nn != NULL && (lvp = nn->null_lowervp) != NULL) {
 		VI_LOCK_FLAGS(lvp, MTX_DUPOK);
 		VI_UNLOCK(vp);
 		/*
@@ -622,7 +622,7 @@ null_unlock(struct vop_unlock_args *ap)
 		mtxlkflag = 2;
 	}
 	nn = VTONULL(vp);
-	if (nn != NULL && (lvp = NULLVPTOLOWERVP(vp)) != NULL) {
+	if (nn != NULL && (lvp = nn->null_lowervp) != NULL) {
 		VI_LOCK_FLAGS(lvp, MTX_DUPOK);
 		flags |= LK_INTERLOCK;
 		vholdl(lvp);


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Dec 2 04:55:31 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=141091 
>Unformatted:
