Subject: Re: Crash during shutdown (current 4.99.33)
To: Current Users <current-users@netbsd.org>
From: Juraj Hercek <nbsd@hck.sk>
List: current-users
Date: 10/16/2007 18:45:55
Juergen Hannken-Illjes wrote:
> On Tue, Oct 16, 2007 at 05:58:08PM +0200, Juraj Hercek wrote:
>
>> Hello,
>>
>> I've got a crash when doing shutdown:
>>
>> Kernel: 4.99.33 built on Oct 14 15:57:29 CEST 2007
>>
>> -----
>> Done running shutdown hooks.
>> Oct 16 16:21:35 syslogd: Exiting on signal 15
>> syncing disks... done
>> unmounting file systems...
>> unmounting /kern (kernfs)...
>> unmounting /usr/pkg/etc (<above>:/local/usr/pkg/etc)...
>> unmounting /root (<above>:/local/root)...panic: kernel diagnostic
>> assertion "(flags &
>> ~(LK_INTERLOCK|LK_SHARED|LK_EXCLUSIVE|LK_DRAIN|LK_NOWAIT|LK_RETRY|
>> LK_SETRECURSE|LK_CANRECURSE)) == 0" failed: file
>> "/netbsd/src/sys/kern/vfs_vnops.c", line 671
>> fatal breakpoint trap in supervisor mode
>> trap type 1 code 0 eip c03dcfe9 cs 9 eflags 246 cr2 0 ilevel 0
>> Stopped in pid 1529.1 (halt) at netbsd:breakpoint+0x1: ret
>> db> bt
>> breakpoint(c049c57c,c0459f8b,c049505c,c0495028,29f) at netbsd:breakpoint+0x1
>> __kernassert(c0459f8b,c0495028,29f,c049505c,7) at netbsd:__kernassert+0x39
>> vn_lock(cb27a498,800002,cb3029dc,c04f5d80,cb2ea410) at netbsd:vn_lock+0xce
>>
>
> flags == 0x800002 == <LK_RESURRECT LK_EXCLUSIVE>
> looks like LK_RESURRECT should be added to the assertion of vn_lock()
>
Right, I've added LK_RESURRECT to vfs_vnops.c and it helped, however
only partially, because also modification of ffs_vnops.c was necessary
to get clean shutdown. Here's what I've changed:
Index: kern/vfs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_vnops.c,v
retrieving revision 1.143
diff -u -r1.143 vfs_vnops.c
--- kern/vfs_vnops.c 10 Oct 2007 20:42:27 -0000 1.143
+++ kern/vfs_vnops.c 16 Oct 2007 16:38:31 -0000
@@ -667,7 +667,7 @@
#endif
KASSERT((flags &
~(LK_INTERLOCK|LK_SHARED|LK_EXCLUSIVE|LK_DRAIN|LK_NOWAIT|LK_RETRY|
- LK_SETRECURSE|LK_CANRECURSE))
+ LK_SETRECURSE|LK_CANRECURSE|LK_RESURRECT))
== 0);
do {
Index: ufs/ffs/ffs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_vnops.c,v
retrieving revision 1.92
diff -u -r1.92 ffs_vnops.c
--- ufs/ffs/ffs_vnops.c 10 Oct 2007 20:42:34 -0000 1.92
+++ ufs/ffs/ffs_vnops.c 16 Oct 2007 16:38:34 -0000
@@ -759,7 +759,7 @@
return (lockmgr(vp->v_vnlock, flags, &vp->v_interlock));
KASSERT((flags & ~(LK_SHARED | LK_EXCLUSIVE | LK_SLEEPFAIL |
- LK_INTERLOCK | LK_NOWAIT | LK_SETRECURSE | LK_CANRECURSE)) == 0);
+ LK_INTERLOCK | LK_NOWAIT | LK_SETRECURSE | LK_CANRECURSE |
LK_RESURRECT)) == 0);
for (;;) {
if ((flags & LK_INTERLOCK) == 0) {
simple_lock(&vp->v_interlock);
Question is, how many *_vnops.c files need to be changed...
Regards,
Juraj