Subject: kern/32005: panic: lockmgr: release of unlocked lock! with fssconfig
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Pavel Cahyna <pcah8322@artax.karlin.mff.cuni.cz>
List: netbsd-bugs
Date: 11/05/2005 17:03:00
>Number:         32005
>Category:       kern
>Synopsis:       panic: lockmgr: release of unlocked lock! with fssconfig
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 05 17:03:00 +0000 2005
>Originator:     Pavel Cahyna
>Release:        NetBSD 3.0_BETA
>Organization:
>Environment:
System: NetBSD beta 3.0_BETA NetBSD 3.0_BETA (BETA) #4: Fri Oct 7 21:20:07 CEST 2005 root@beta:/usr/src/sys/arch/alpha/compile/BETA alpha
Architecture: alpha
Machine: alpha
>Description:
	I was running this sample program:
-- cut here
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>

int main(void)
{
	const int length = 1024*1024*200;
	int e;
	pwrite(1, "t", 1, length);
	char* buf = mmap(NULL, length, PROT_WRITE, MAP_SHARED|MAP_FILE, 1, 0);
	if(buf == MAP_FAILED) {
		perror("mmap");
		exit(1);
	};
	memset(buf, 't', length);
	if(msync(buf, length, MS_SYNC)) {
		perror("msync");
		exit(1);
	};
	if((e = system("fssconfig fss0 / /msyncsnap") ) == -1) {
		perror("system");
		exit(1);
	};
	fprintf(stderr, "fssconfig returned: %d\n", e);
	exit(0);
}
-- cut here
and the system paniced:
panic: lockmgr: release of unlocked lock!
cpu_Debugger() at netbsd:cpu_Debugger+0x4
panic() at netbsd:panic+0x208
lockmgr() at netbsd:lockmgr+0x328
genfs_unlock() at netbsd:genfs_unlock+0x2c
VOP_UNLOCK() at netbsd:VOP_UNLOCK+0x44
ufs_inactive() at netbsd:ufs_inactive+0x90
VOP_INACTIVE() at netbsd:VOP_INACTIVE+0x44
vput() at netbsd:vput+0x140
vn_open() at netbsd:vn_open+0x41c
sys_open() at netbsd:sys_open+0xfc
syscall_plain() at netbsd:syscall_plain+0xc4
XentSys() at netbsd:XentSys+0x5c
--- syscall (5) ---
--- user mode ---

The panic happened in the emacs process, running in X11 on another
virtual console. But accordign to ps, fssconfig was running at that
time, so I suspect it was the cause.
>How-To-Repeat:
I was unable to repeat, unfortunately.
>Fix:
unknown.