Subject: kern/12661: panic: lockmgr: release of unlocked lock! in dev_mkdb
To: None <gnats-bugs@gnats.netbsd.org>
From: Ben Harris <bjh21@netbsd.org>
List: netbsd-bugs
Date: 04/15/2001 10:30:55
>Number:         12661
>Category:       kern
>Synopsis:       panic: lockmgr: release of unlocked lock! in dev_mkdb
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 15 02:31:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Ben Harris
>Release:        2001-04-13
>Organization:
>Environment:
NetBSD/arm26 system, root on NFS over ei0.

>Description:
When running dev_mkdb (either manually from a single-user shell or
automatically as part of a multi-user boot), I get:

panic: lockmgr: release of unlocked lock!

Adding a printf indicates that the lock is the v_lock field of the vnode
associated with /dev/md0a.

That vnode looks like this to "show vnode" (ten-fingered):

OBJECT 0x2408140: locked=0, pgops=0x21d2f54, npages=0, refs=1

VNODE flags 0
simple_lock: lock held
lock: 0x24081dc, currently at: ../../../../kern/kern_lock.c:357
last locked: ../../../../kern/kern_lock.c:461
mp 0x1846600 nio 0 size 0xffffffff rwlock 0x0 glock 0x0
data 0x2416030 usecount 1 writecount 0 holdcnt 0 numountput 0
type VBLK(3) tag VT_NFS(2) id 0x1d9 mount 0x1846600 typedata 0x1837c80
lastr 0x0 lastw 0x0 lasta 0x0
cstart 0x0 clen 0x0 ralen 0x0 maxra 0x0

[ simple_lock messages are because the interlock on the v_lock field is
  already held ]

"show ncache" says:

name md0a

The lock_file field of the v_lock shows it as never having been locked.

Stack backtrace shows (saved registers omitted to save fingers):

panic
_lockmgr
genfs_unlock
VOP_UNLOCK
vput
sys___lstat13
syscall
swi_handler

>How-To-Repeat:
Boot single-user with root on NFS (at least, on ei0).  Run dev_mkdb.

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted: