Subject: Re: simple_lock: uninitialized lock
To: Patrick Welche <prlw1@newn.cam.ac.uk>
From: Antti Kantee <pooka@cs.hut.fi>
List: current-users
Date: 07/16/2007 22:23:18
On Mon Jul 16 2007 at 19:31:52 +0100, Patrick Welche wrote:
> Finally a panic while I'm not in X... Today's CVS on i386:

Sounds like this is not the pilot or even first season.  Got a pointer
to earlier episodes I've missed?

> simple_lock: uninitialized lock
> lock: 0xce707ef8, currently at: ../../../../kern/kern_synch.c:184
> uvm_fault(0xc05c3da0, 0xdeadb000, 1) -> 0xe
> kernel: supervisor trap page fault, code=0
> Stopped in pid 0.17 (system) at netbsd:strlen+0x8:    cmpb  $0,0(%eax)
>  
> strlen+0x8
> vsnprintf+0x42
> lock_printf(c0531a16,deadbeef,ffffbeef,b8,c) lock_printf+0x5f
> _simple_lock+0x8c
> ltsleep+0x18f
> acquire_0xb0
> _lockmgr+0x507
> ufs_lock+0x4f
> VOP_LOCK+0x25
> vn_lock+0x9f
> vrele+0x130
> vget_0x90
> ffs_sync_0xde
> sync_fsync+0xaa
> VOP_FSYNC+0x49 
> sched_sync+0xf5
> db> show lock  
> Sorry, no record of a lock with address 0xc0492fd0 found.
> db> sync

Hmm, deadbeef hints that the vnode has been returned to the pool, but
I don't see how it could make it that far from the syncer.  "show vnode
<addr>" in ddb for the vnode in question would be helpful, if that's at
all possible if you bump into this again.  <addr> is the first parameter
to VOP_LOCK (I assume this was hand-copied and that's why the function
arguments are missing).

Also, this patch might help in tracking the issue down:

Index: vfs_subr.c
===================================================================
RCS file: /cvsroot/src/sys/kern/vfs_subr.c,v
retrieving revision 1.289
diff -p -u -r1.289 vfs_subr.c
--- vfs_subr.c	9 Jul 2007 11:35:20 -0000	1.289
+++ vfs_subr.c	16 Jul 2007 19:23:24 -0000
@@ -1203,6 +1203,7 @@ vget(struct vnode *vp, int flags)
 #endif
 	if (flags & LK_TYPE_MASK) {
 		if ((error = vn_lock(vp, flags | LK_INTERLOCK))) {
+			printf("vn_lock failed with %d\n", error);
 			vrele(vp);
 		}
 		return (error);

-- 
Antti Kantee <pooka@iki.fi>                     Of course he runs NetBSD
http://www.iki.fi/pooka/                          http://www.NetBSD.org/
    "la qualité la plus indispensable du cuisinier est l'exactitude"