tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
fix LOCKDEBUG crash in vfs
Hi!
At boot when fsck finishes on ffs w/o wapbl,
I get a LOCKDEBUG panic:
Mutex error: lockdebug_wantlock: locking against myself
lock address : 0xffff80004ba70d68 type : sleep/adaptive
initialized : 0xffffffff8075d0fa
shared holds : 0 exclusive: 1
shares wanted: 0 exclusive: 1
current cpu : 1 last held: 1
current lwp : 0xffff80004ea10800 last held: 0xffff80004ea10800
last locked : 0xffffffff80764868 unlocked : 0xffffffff80763f91
owner field : 0xffff80004ea10800 wait/spin: 0/0
Turnstile chain at 0xffffffff80d55b10.
=> No active turnstile for this lock.
panic: LOCKDEBUG
fatal breakpoint trap in supervisor mode
trap type 1 code 0 rip ffffffff8024c5c5 cs 8 rflags 246 cr2 412bd8 cpl 0
rsp fff
f80004ea23690
Stopped in pid 10.1 (fsck_ffs) at netbsd:breakpoint*0x5: leave
db{1}> bt
breakpoint+0x5
panic+0x289
lockdebug_abort1+0xd3
mutex_enter+0x3d8
mountd_set_exports_list+0x10c
nfs_export_update_30+0x40
vfs_hooks_reexport+0x4c
do_sys_mount+0x72b
sys___mount50+0x33
syscall+0xc2
initialized: sys/kern/vfs_subr.c:485
mutex_init(&mp->mnt_updating, MUTEX_DEFAULT, IPL_NONE);
last locked: sys/kern/vfs_syscall.c:187
mutex_enter(&mp->mnt_updating);
unlocked: sys/kern/vfs_syscall.c:788
mutex_exit(&mp->mnt_updating);
This LOCKDEBUG panic is only reproducable when fsck runs.
On a clean ffs this panic doesn't happen.
Attached is a fix.
I am not familiar with VFS code at all, so I don't know
if the fix is correct. With it I no longer can reproduce the LOCKDEBUG
panic at least.
Christoph
Index: sys/kern/vfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_syscalls.c,v
retrieving revision 1.394
diff -u -p -r1.394 vfs_syscalls.c
--- sys/kern/vfs_syscalls.c 2 May 2009 14:13:28 -0000 1.394
+++ sys/kern/vfs_syscalls.c 14 Jun 2009 08:02:41 -0000
@@ -209,6 +209,7 @@ mount_update(struct lwp *l, struct vnode
MNT_LOG | MNT_IGNORE);
error = VFS_MOUNT(mp, path, data, data_len);
+ mutex_exit(&mp->mnt_updating);
if (error && data != NULL) {
int error2;
@@ -228,6 +229,7 @@ mount_update(struct lwp *l, struct vnode
error = error2;
}
+ mutex_enter(&mp->mnt_updating);
if (mp->mnt_iflag & IMNT_WANTRDWR)
mp->mnt_flag &= ~MNT_RDONLY;
if (error)
Home |
Main Index |
Thread Index |
Old Index