crash: lockmgr: locking against myself

2003-03-15 Thread FUJITA Kazutoshi
Hi,

My -CURRENT(2003/03/14) box crashes when I tried to mount UDF(DVD-RAM).

# mount -t udf -o ro /dev/acd0 /dvdram


Here is the stack trace,

# gdb -k kernel.debug.0 vmcore.0
GNU gdb 5.2.1 (FreeBSD)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for details.
This GDB was configured as i386-undermydesk-freebsd...
panic: (fmt null)

panic messages:
---
panic: lockmgr: locking against myself

syncing disks, buffers remaining... 3848 3848 Copyright (c) 1992-2003 The FreeBSD 
Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD 5.0-CURRENT-20030314-JPSNAP #1: Sat Mar 15 18:59:26 JST 2003
[EMAIL PROTECTED]:/usr/src/sys/i386/compile/FAITHIA
Preloaded elf kernel /boot/kernel/kernel at 0xc0802000.
Preloaded elf module /boot/kernel/acpi.ko at 0xc08020a8.
Timecounter i8254  frequency 1193182 Hz
Timecounter TSC  frequency 282900 Hz
CPU: Intel(R) Pentium(R) 4 CPU 2.00GHz (2000.08-MHz 686-class CPU)
  Origin = GenuineIntel  Id = 0xf24  Stepping = 4
  Features=0x3febf9ffFPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,P
AT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM
real memory  = 536805376 (511 MB)
avail memory = 512778240 (489 MB)
Allocating major#253 to net
Allocating major#252 to pci
Pentium Pro MTRR support enabled
npx0: math processor on motherboard
npx0: INT 16 interface
acpi0: AMIINT SiS645XX on motherboard
ACPI-0625: *** Info: GPE Block0 defined as GPE0 to GPE15
ACPI-0625: *** Info: GPE Block1 defined as GPE16 to GPE31
pcibios: BIOS version 2.10
Using $PIR table, 8 entries at 0xc00f7ae0
acpi0: power button is handled as a fixed feature programming model.
Timecounter ACPI-fast  frequency 3579545 Hz
:acpi_timer0: 24-bit timer at 3.579545MHz port 0x808-0x80b on acpi0
acpi_cpu0: CPU port 0x530-0x537 on acpi0
acpi_button0: Power Button on acpi0
pcib0: ACPI Host-PCI bridge port 0xcf8-0xcff on acpi0
pci0: ACPI PCI bus on pcib0
agp0: SIS Generic host to PCI bridge mem 0xe000-0xe3ff at device 0.0 on pci0
pcib1: PCIBIOS PCI-PCI bridge at device 1.0 on pci0
pci1: PCI bus on pcib1
pci1: display, VGA at device 0.0 (no driver attached)
isab0: PCI-ISA bridge at device 2.0 on pci0
isa0: ISA bus on isab0
ohci0: SiS 5571 USB controller mem 0xdfffe000-0xdfffefff irq 11 at device 2.2 on pci0
usb0: OHCI version 1.0, legacy support
usb0: SiS 5571 USB controller on ohci0
usb0: USB revision 1.0
uhub0: SiS OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 3 ports with 3 removable, self powered
ohci1: SiS 5571 USB controller mem 0xd000-0xdfff irq 5 at device 2.3 on pci0
usb1: OHCI version 1.0, legacy support
usb1: SiS 5571 USB controller on ohci1
usb1: USB revision 1.0
uhub1: SiS OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 3 ports with 3 removable, self powered
pci0: mass storage, ATA at device 2.5 (no driver attached)
pcm0: SiS 7012 port 0xd800-0xd87f,0xdc00-0xdcff irq 11 at device 2.7 on pci0
pcm0: C-Media Electronics CMI9738 AC97 Codec
sis0: SiS 900 10/100BaseTX port 0xd400-0xd4ff mem 0xdfff9000-0xdfff9fff irq 5 at 
device 3.0 on pci0
sis0: Ethernet address: 00:07:95:c0:de:e2
miibus0: MII bus on sis0
rlphy0: RTL8201L 10/100 media interface on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
em0: Intel(R) PRO/1000 Network Connection, Version - 1.4.10 port 0xd000-0xd03f mem 
0xdff8-0xdff9,0xdffa-0xdffb irq 11 at device 9.0 on pci0
em0:  Speed:100 Mbps  Duplex:Full
fxp0: Intel 82557/8/9 EtherExpress Pro/100(B) Ethernet port 0xcc00-0xcc3f mem 
0xdff4-0xdff5,0xdfff8000-0xdfff8fff irq 5 at device 11.0 on pci0
fxp0: Ethernet address 00:02:b3:a6:83:2d
inphy0: i82555 10/100 media interface on miibus1
inphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
acpi_button1: Sleep Button on acpi0
atkbdc0: Keyboard controller (i8042) port 0x64,0x60 irq 1 on acpi0
atkbd0: AT Keyboard flags 0x1 irq 1 on atkbdc0
kbd0 at atkbd0
psm0: PS/2 Mouse irq 12 on atkbdc0
psm0: model IntelliMouse Explorer, device ID 4
fdc0: cmd 3 failed at out byte 1 of 3
sio0 port 0x3f8-0x3ff irq 4 on acpi0
sio0: type 16550A
sio1 port 0x2f8-0x2ff irq 3 on acpi0
sio1: type 16550A
ppc0 port 0x778-0x77b,0x378-0x37f irq 7 drq 3 on acpi0
ppc0: Generic chipset (ECP/PS2/NIBBLE) in COMPATIBLE mode
ppc0: FIFO with 16/16/16 bytes threshold
plip0: PLIP network interface on ppbus0
lpt0: Printer on ppbus0
lpt0: Interrupt-driven port
ppi0: Parallel I/O on ppbus0
fdc0: cmd 3 failed at out byte 1 of 3
orm0: Option ROMs at iomem 
0xcf000-0xd4fff,0xcd800-0xcefff,0xcc000-0xcd7ff,0xc-0xcbfff on isa0
pmtimer0 on isa0
ata0 at port 0x3f6,0x1f0-0x1f7 irq 14 on isa0
ata1 at port 0x376,0x170-0x177 irq 15 on isa0
fdc0: cannot 

Re: crash: lockmgr: locking against myself

2003-03-15 Thread Tim Robbins
On Sat, Mar 15, 2003 at 08:27:27PM +0900, FUJITA Kazutoshi wrote:

 Hi,
 
 My -CURRENT(2003/03/14) box crashes when I tried to mount UDF(DVD-RAM).
 
 # mount -t udf -o ro /dev/acd0 /dvdram
[...]
 panic: lockmgr: locking against myself
[...]
 (kgdb) bt
[...]
 #10 0xc039bcbb in panic (fmt=0x0) at ../../../kern/kern_shutdown.c:528
 #11 0xc038e141 in lockmgr (lkp=0xc4bce1e0, flags=16973826, interlkp=0x100, 
 td=0xc4a023c0) at ../../../kern/kern_lock.c:447
 #12 0xc03e93dc in vop_stdlock (ap=0x0) at ../../../kern/vfs_default.c:304
 #13 0xc03e9228 in vop_defaultop (ap=0x0) at ../../../kern/vfs_default.c:163
 #14 0xc03ffbde in vn_lock (vp=0xc4bce124, flags=131074, td=0xc4a023c0)
 at vnode_if.h:990
 #15 0xc034e45c in udf_hashins (node=0xc4bd1000)
 at ../../../fs/udf/udf_vnops.c:133
 #16 0xc034dea4 in udf_vget (mp=0xc4ae6c00, ino=139, flags=0, vpp=0xdd0c7af4)
 at ../../../fs/udf/udf_vfsops.c:617
 #17 0xc034db7e in udf_root (mp=0xc4b44000, vpp=0x8b)
 at ../../../fs/udf/udf_vfsops.c:505

It seems that udf_vget() calls udf_allocv(), which returns a locked vnode.
udf_vget() then calls udf_hashins(), which tries to lock the vnode again,
causing the locking against myself panic.

Here's a simple untested patch to try which makes udf_allocv() return
an unlocked vnode. I'm not sure whether the locking in udf_hashins()
is right.

Index: sys/fs/udf/udf_vnops.c
===
RCS file: /home/ncvs/src/sys/fs/udf/udf_vnops.c,v
retrieving revision 1.24
diff -u -r1.24 udf_vnops.c
--- sys/fs/udf/udf_vnops.c  3 Mar 2003 19:15:39 -   1.24
+++ sys/fs/udf/udf_vnops.c  15 Mar 2003 12:12:13 -
@@ -127,10 +127,10 @@
 
udfmp = node-udfmp;
 
+   vn_lock(node-i_vnode, LK_EXCLUSIVE | LK_RETRY, curthread);
mtx_lock(udfmp-hash_mtx);
TAILQ_INSERT_TAIL(udfmp-udf_tqh, node, tq);
mtx_unlock(udfmp-hash_mtx);
-   vn_lock(node-i_vnode, LK_EXCLUSIVE | LK_RETRY, curthread);
 
return (0);
 }
@@ -161,7 +161,6 @@
return (error);
}
 
-   vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
*vpp = vp;
return (0);
 }



Tim

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message


Re: crash: lockmgr: locking against myself

2003-03-15 Thread FUJITA Kazutoshi
From: Tim Robbins [EMAIL PROTECTED]
Subject: Re: crash: lockmgr: locking against myself
Date: Sun, 16 Mar 2003 00:36:41 +1100
Message-ID: [EMAIL PROTECTED]

 Here's a simple untested patch to try which makes udf_allocv() return
 an unlocked vnode. I'm not sure whether the locking in udf_hashins()
 is right.

It looks good for me.
At least, crash is avoided and mount successfully.


Regards,

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message