Subject: kern/37576: Reader / writer lock error
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <prlw1@cam.ac.uk>
List: netbsd-bugs
Date: 12/20/2007 18:20:00
>Number:         37576
>Category:       kern
>Synopsis:       panic when mounting cdrom
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 20 18:20:00 +0000 2007
>Originator:     Patrick Welche
>Release:        NetBSD 4.99.42
>Organization:
>Environment:
NetBSD-current/i386 of 10th Dec 2007 and today 20th Dec show the problem,
2nd November 2007 doesn't.
>Description:
mount -t cd9660 /dev/cd1a /cdrom

gives the panic:

Reader / writer lock error: lockdebug_alloc: already initialized

lock address : 0x00000000d0c95f04 type     :     sleep/adaptive
shared holds :                  0 exclusive:                  0
shares wanted:                  0 exclusive:                  0
current cpu  :                  0 last held:                  0
current lwp  : 0x00000000cd40a8c0 last held: 000000000000000000
last locked  : 000000000000000000 unlocked : 000000000000000000
initialized  : 0x00000000c03b5d00
owner/count  : 000000000000000000 flags    : 000000000000000000

Turnstile chain at 0xc062a520.
=> No active turnstile for this lock.

panic: LOCKDEBUG
Stopped in pid 213.1 (mountd) at        netbsd:breakpoint+0x1:  ret

 PID           PPID     PGRP        UID S   FLAGS LWPS          COMMAND    WAIT
>213              1      213          0 2       0    1           mountd

db{0}> bt
breakpoint(c053451a,cd4f5868,0,0,cd4f5868) at netbsd:breakpoint+0x1
panic(c0533760,c035d48c,c05333b4,c05333c4,d132b2c0) at netbsd:panic+0xd1
lockdebug_abort1(d132b2c0,c06349c0,c05333b4,c05333c4,1) at netbsd:lockdebug_abor
t1+0x6e
lockdebug_alloc(d0c95f04,c05eb808,c03b5d00,0,0) at netbsd:lockdebug_alloc+0x74
rw_init(d0c95f04,0,d0c95fdc,d0c95f00,0) at netbsd:rw_init+0x29
genfs_node_init(d3fde9ac,c0519134,80,0,cd40a8c0) at netbsd:genfs_node_init+0x20
cd9660_vget_internal(c35f8000,12000,0,cd4f59c8,0) at netbsd:cd9660_vget_internal
+0x1a4
cd9660_root(c35f8000,cd4f59c8,0,cd40a8c0,13daec0) at netbsd:cd9660_root+0x6d
lookup(cd4f5aa0,20002,400,cd4f5abc,cc083f00) at netbsd:lookup+0x6e7
namei(cd4f5aa0,2,0,c0356462,c0634a00) at netbsd:namei+0x37b
mountd_set_exports_list(cd4f5b4c,cd40a8c0,0,c03556ff,c0634a00) at netbsd:mountd_
set_exports_list+0x67
sys_nfssvc(cd40a8c0,cd4f5c34,cd4f5c2c,2,c03e3659) at netbsd:sys_nfssvc+0x37b
syscall(cd4f5c78,b3,ab,23,23) at netbsd:syscall+0x1d6
db{0}> show mount c35f8000
vnodecovered = 0xd6ed27a4 syncer = 0x0 data = 0xc3928080
fs_bshift 11 dev_bshift = 2048
flag = 1001<MNT_LOCAL,MNT_RDONLY>
iflag = 0
 lock type vfslock: SHARED (count 1)
statvfs cache:
        bsize = 2048
        frsize = 2048
        iosize = 2048
        blocks = 259661
        bfree = 0
        bavail = 0
        bresvd = 0
        files = 0
        ffree = 0
        favail = 0
        fresvd = 0
        f_fsidx = { 0x608, 0x1e5c8 }
        owner = 0
        namemax = 511
        flag = 0
        syncwrites = 0
        asyncwrites = 0
        syncreads = 0
        asyncreads = 0
        fstypename = cd9660
        mntonname = /cdrom
        mntfromname = /dev/cd1a
locked vnodes =


Tried again this time with nfsd and mountd running:

db{1}> bt
breakpoint(c0535936,cd7558f8,0,0,cd7558f8) at netbsd:breakpoint+0x1
panic(c0534b60,c035e2bc,c05347b4,c05347c4,cdd6aec0) at netbsd:panic+0xd1
lockdebug_abort1(cdd6aec0,c06369c0,c05347b4,c05347c4,1) at netbsd:lockdebug_abor
t1+0x6e
lockdebug_alloc(cdd1df04,c05ed808,c03b6c38,0,0) at netbsd:lockdebug_alloc+0x74
rw_init(cdd1df04,0,cdd1dfdc,cdd1df00,0) at netbsd:rw_init+0x29
genfs_node_init(cdd12274,c051a414,80,0,cd824e00) at netbsd:genfs_node_init+0x20
cd9660_vget_internal(c345c000,12000,0,cd755a58,0) at netbsd:cd9660_vget_internal
+0x1a4
cd9660_root(c345c000,cd755a58,0,cd824e00,1c45e00) at netbsd:cd9660_root+0x6d
lookup(cd755b30,20002,400,cd755b4c,cd755a07) at netbsd:lookup+0x6e7
namei(cd755b30,0,80000000,c03563ec,5) at netbsd:namei+0x37b
do_sys_stat(cd824e00,bb9190cc,40,cd755ba0,c0636a00) at netbsd:do_sys_stat+0x36
sys___stat30(cd824e00,cd755c34,cd755c2c,c04652cd,cd755c07) at netbsd:sys___stat3
0+0x32
syscall(cd755c78,b3,ab,1f,1f) at netbsd:syscall+0x1d6


Same CD mounts fine on NetBSD-current/i386 4.99.34 of 2nd Nov.

>How-To-Repeat:
Mount a CD - am I the only one with this problem? (Seems hard to believe.)
>Fix:
	

>Unformatted: