kern/141091: [patch] [nullfs] fix panics with DIAGNOSTIC enabled

Gleb Kurtsou gk at FreeBSD.org
Wed Dec 2 03:00:13 UTC 2009


>Number:         141091
>Category:       kern
>Synopsis:       [patch] [nullfs] fix panics with DIAGNOSTIC enabled
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>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:
>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 at 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:
>Unformatted:


More information about the freebsd-bugs mailing list