NetBSD Problem Report #5113

Received: (qmail 10972 invoked from network); 3 Mar 1998 21:58:02 -0000
Message-Id: <199803032154.WAA00344@rochebonne.lip6.fr>
Date: Tue, 3 Mar 1998 22:54:54 +0100 (MET)
From: bouyer@antioche.lip6.fr
Reply-To: bouyer@antioche.lip6.fr
To: gnats-bugs@gnats.netbsd.org
Subject: kernel panic when vnconfig'ing
X-Send-Pr-Version: 3.95

>Number:         5113
>Category:       kern
>Synopsis:       kernel panic when vnconfig'ing
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 04 07:05:04 +0000 1998
>Closed-Date:    Thu Mar 12 16:42:29 +0000 1998
>Last-Modified:  Thu Mar 12 16:47:02 +0000 1998
>Originator:     Manuel Bouyer
>Release:        NetBSD-current cvs update'ed Mon, 3 march
>Organization:

Laboartoire d'Informatique de Paris VI

>Environment:

System: NetBSD rochebonne.lip6.fr 1.3E NetBSD 1.3E (ROCHEBONNE) #5: Tue Mar 3 22:14:03 MET 1998 bouyer@rochebonne.lip6.fr:/home/bouyer/1.3E/src/sys/arch/i386/compile/ROCHEBONNE i386


>Description:
	When attaching a file to a vnd device, the kernel panic with
	"panic: lockmgr: unknown locktype request 0"
	The backtrace looks like:
	lockmgr()
	ufs_look()
	vn_look()
	vndstrategy()
	readdisklabel()
	...

>How-To-Repeat:
	vnconfig -v /dev/vnd0d /tmp/ffsfile
>Fix:

	The problem is that vndstrategy calls vn_lock() with the second argument
	(flags) set to 0. This is passed up to lockmgr().
	Passing (LK_EXCLUSIVE | LK_RETRY) solves the problem, but may be a too
	conservative approach. The XXX comments here also stats:
	"check if vnode is already locked, to avoid
	 recursive locking. The real solution is to
	 allow recursive locks here, but the interface
	 doesn't allow it." 
	It seems that the lite-2 interface allows recursive locks, but I didn't
	go deeper into this.

--- vnd.c.old	Tue Mar  3 21:47:54 1998
+++ vnd.c	Tue Mar  3 21:51:50 1998
@@ -401,7 +401,7 @@
 		 */
 		if (!VOP_ISLOCKED(vnd->sc_vp)) {
 			dolock = 1;
-			vn_lock(vnd->sc_vp, 0);
+			vn_lock(vnd->sc_vp, LK_EXCLUSIVE | LK_RETRY);
 		}
 		error = VOP_BMAP(vnd->sc_vp, bn / bsize, &vp, &nbn, &nra);
 		if (dolock)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: bouyer 
State-Changed-When: Thu Mar 12 08:42:29 PST 1998 
State-Changed-Why:  
Fixed by changing 0 to LK_EXCLUSIVE | LK_RETRY | LK_CANRECURSE, so that we can get ride of the local hack to avoid recursive locking. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.