NetBSD Problem Report #1256

From gnats  Sat Jul 22 19:19:35 1995
Received: from sonyinet.sony.co.jp (sonyinet.sony.co.jp [202.24.32.17]) by sun-lamp.pc.cs.cmu.edu (8.6.11/8.6.10) with ESMTP id TAA08472 for <gnats-bugs@gnats.netbsd.org>; Sat, 22 Jul 1995 19:19:33 -0400
Message-Id: <199507220536.OAA00258@king-show.sys.ptg.sony.co.jp>
Date: Sat, 22 Jul 1995 14:36:48 +0900
From: enami tsugutomo <enami@sys.ptg.sony.co.jp>
Reply-To: enami@sys.ptg.sony.co.jp
To: gnats-bugs@gnats.netbsd.org
Subject: panic lockholder (156) != 0
X-Send-Pr-Version: 3.2

>Number:         1256
>Category:       kern
>Synopsis:       3 or more simultaneous access to CD-ROM causes panic.
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 22 19:20:01 +0000 1995
>Closed-Date:    Thu Dec 03 19:23:43 +0000 1998
>Last-Modified:  Thu Dec 03 19:28:12 +0000 1998
>Originator:     enami tsugutomo
>Release:        arround jul 7
>Organization:
	Sony Corporation
>Environment:
System: NetBSD king-show 1.0A NetBSD 1.0A (KINGSHOW) #10: Sat Jul 22 14:11:11 JST 1995 root@king-show:/usr/src/sys/arch/i386/compile/KINGSHOW i386
	SCSI Adaptor: Buslogic BT-445C
	CD-ROM drive: ICM CD-620S or Nakamichi MBR-7.4

>Description:
	If 3 or more processes access save cdrom drive simltaneously,
	kernel panics with message "lockholder (XXX) != 0" at cd9660_lock.
>How-To-Repeat:
	# assume that cdrom is mounted on /cd/0
	find /cd/0 -print & find /cd/0 -print & find /cd/0 -print &
>Fix:
	In the function cd9660_lock, it seems that we should go back
	to check if someone has lock after wakeup from sleep.  Otherwise,
	two or more slept processes work without locking each other.

	So, I tried to put `goto start;' just after the sleep,
	but it seems the panic is gone, but some processes are
	deadlocked now.
>Release-Note:
>Audit-Trail:

From: Chris G Demetriou <Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU>
To: enami@sys.ptg.sony.co.jp
Cc: gnats-bugs@gnats.netbsd.org, mycroft@netbsd.org
Subject: Re: kern/1256: panic lockholder (156) != 0 
Date: Mon, 24 Jul 1995 01:00:33 -0400

 > >Description:
 > 	If 3 or more processes access save cdrom drive simltaneously,
 > 	kernel panics with message "lockholder (XXX) != 0" at cd9660_lock.
 > >How-To-Repeat:
 > 	# assume that cdrom is mounted on /cd/0
 > 	find /cd/0 -print & find /cd/0 -print & find /cd/0 -print &

 I cannot duplicate this; it appears to be a timing-dependent problem,
 and it doesn't show up for me.  however, looking at the code, there is
 a bug.

 > >Fix:
 > 	In the function cd9660_lock, it seems that we should go back
 > 	to check if someone has lock after wakeup from sleep.  Otherwise,
 > 	two or more slept processes work without locking each other.
 > 
 > 	So, I tried to put `goto start;' just after the sleep,
 > 	but it seems the panic is gone, but some processes are
 > 	deadlocked now.

 looking at the code, and comparing to UFS, 'goto start;' should work.

 There appears to be some similar code in 'cd9660_ihashget'.  However,
 looking at it, it appears to do the right thing after sleeping.


 I'd be interested to know _where_ those processes are
 deadlocked...



 chris

From: enami tsugutomo <enami@sys.ptg.sony.co.jp>
To: Chris G Demetriou <Chris_G_Demetriou@BALVENIE.PDL.CS.CMU.EDU>
Cc: gnats-bugs@gnats.netbsd.org, mycroft@NetBSD.ORG
Subject: Re: kern/1256: panic lockholder (156) != 0 
Date: Sun, 12 Nov 1995 17:13:28 +0900

 	Sorry for too late reply.

 >  looking at the code, and comparing to UFS, 'goto start;' should work.
 > 
 >  There appears to be some similar code in 'cd9660_ihashget'.  However,
 >  looking at it, it appears to do the right thing after sleeping.
 >  
 >  
 >  I'd be interested to know _where_ those processes are
 >  deadlocked...

 	I got the stack trace of them.
 enami.


 	The kernel I used is Nov 05 kernel (NetBSD/i386 1.1 ALPHA)
 	with adding goto start in the function cd9660_lock, like this,
 ===================================================================
 RCS file: RCS/cd9660_vnops.c,v
 retrieving revision 1.1
 diff -u -r1.1 cd9660_vnops.c
 --- cd9660_vnops.c	1995/11/12 07:03:53	1.1
 +++ cd9660_vnops.c	1995/11/12 07:04:21
 @@ -792,6 +792,7 @@
  			ip->i_lockwaiter = -1;
  #endif
  		(void) sleep((caddr_t)ip, PINOD);
 +		goto start;
  	}
  #ifdef DIAGNOSTIC
  	ip->i_lockwaiter = 0;

 	Then I ran five find process concurrently and got deadlock.
 	With three or four process I didn't get deadlock.  I dicided
 	they deadlocked becase they are running more than 30 minites
 	but four or less process are all done in a few minutets.

 	The CD-ROM is mounted on /cd/0, like this:
 /dev/cd0a on /cd/0 type cd9660 (local, read-only)

 	And I did the following commands:
 % cd /cd/0
 % find . -print >/dev/null & find . -print >/dev/null & find . -print >/dev/null & find . -print >/dev/null & find . -print >/dev/null &

 	And they are running like this:
 enami      336  0.0  2.0    84  316 p0  D     4:14PM    0:00.14 . (find)
 enami      337  0.0  2.0    84  316 p0  D     4:14PM    0:00.14 . (find)
 enami      338  0.0  2.0    84  316 p0  D     4:14PM    0:00.14 . (find)
 enami      339  0.0  2.0    84  316 p0  D     4:14PM    0:00.13 . (find)
 enami      340  0.0  2.0    84  316 p0  D     4:14PM    0:00.13 . (find)

 	The output of ps in ddb is:
 db> ps
   pid proc     addr     uid  ppid  pgrp  flag stat em  comm         wchan
   340 f86c1100 f9a35000 1000   120   340  004006  3  netbsd  find   f8732980
   339 f86d9f00 f9a32000 1000   120   339  004006  3  netbsd  find   f8729580
   338 f86d9d00 f9a2f000 1000   120   338  004006  3  netbsd  find   f8729580
   337 f8707d00 f9a2c000 1000   120   337  004006  3  netbsd  find   getblk f8ca
 a15c
   336 f86c1b00 f9a29000 1000   120   336  004006  3  netbsd  find   f8729580
 			:

 	The stack trace of each process is:
 db> x/x 0xf9a3503c
 0xf9a3503c:         f9a36bdc
 db> trace 0xf9a36bdc
 bpendsleep(f86fce80,2f800,f9a36c0c,f8108adc,f8732980) at bpendsleep
 bpendsleep(f8732980,8) at bpendsleep
 _cd9660_ihashget(600,2f800,f86fce80,f8729580,f9a36d00) at _cd9660_ihashget+0x54

 _cd9660_vget_internal(f86b0400,2f800,f9a36cdc,0,f8d9b066) at _cd9660_vget_inter
 nal+0x24
 _cd9660_lookup(f9a36e44,f86fce80,f9a36f24,f9a36f00,f8748020) at _cd9660_lookup+
 0x932
 _lookup(f9a36f00,f870bf00,f9a36f00,f86c1100,241ed) at _lookup+0x257
 _namei(f9a36f00,f870bf00,f86c1100,4,f81a971c) at _namei+0x16b
 _sys_chroot(f9a36f00,f86c1100) at _sys_chroot+0x8d
 _sys_chdir(f86c1100,f9a36f88,f9a36f80,0,9c00) at _sys_chdir+0x37
 _syscall() at _syscall+0x139
 --- syscall (number 12) ---
 0x100395e7:
 db> x/x 0xf9a3203c
 0xf9a3203c:         f9a33c28
 db> trace 0xf9a33c28
 bpendsleep(f8729580,f86fce80,f9a33c54,f810b8d2,f8729580) at bpendsleep
 bpendsleep(f8729580,8) at bpendsleep
 _cd9660_lock(f9a33c64,ef2b,f81a96f0,f86fce80,f9a33e14) at _cd9660_lock+0x22
 _vget(f86fce80,1,f86d8780,f9a33f24,f9a33f10) at _vget+0x87
 _cd9660_lookup(f9a33e44,f86d8780,f9a33f24,f9a33f00,f8748820) at _cd9660_lookup+
 0x196
 _lookup(f9a33f00,f86d1b00,f9a33f00,f86d9f00,241ed) at _lookup+0x257
 _namei(f9a33f00,f86d1b00,f86d9f00,4,f86d1b00) at _namei+0x16b
 _sys_chroot(f9a33f00,f86d9f00) at _sys_chroot+0x8d
 _sys_chdir(f86d9f00,f9a33f88,f9a33f80,0,12400) at _sys_chdir+0x37
 _syscall() at _syscall+0x139
 --- syscall (number 12) ---
 0x100395e7:
 db> x/x 0xf9a2f03c
 0xf9a2f03c:         f9a30e30
 db> trace 0xf9a30e30
 bpendsleep(f8729580,f86fce80,f9a30e5c,f810b8d2,f8729580) at bpendsleep
 bpendsleep(f8729580,8) at bpendsleep
 _cd9660_lock(f9a30f14) at _cd9660_lock+0x22
 _sys_getdirentries(f86d9d00,f9a30f88,f9a30f80,0,7040) at _sys_getdirentries+0xc
 5
 _syscall() at _syscall+0x139
 --- syscall (number 196) ---
 0x1004e02b:
 db> x/x 0xf9a2c03c
 0xf9a2c03c:         f9a2db34
 db> trace 0xf9a2db34
 bpendtsleep(f8caa15c,0,f86a3c74,0,f9a2db70) at bpendtsleep
 bpendtsleep(f8caa15c,11,f8127d9d,0,f9a2dc48) at bpendtsleep
 _getblk(f86fce80,0,800,0,0) at _getblk+0x7d
 _bread(f86fce80,0,800,ffffffff,f9a2dbd0) at _bread+0x21
 _cd9660_blkatoff(f9a2dc48,f86fce80,f9a2de64,f9a2de50,32000) at _cd9660_blkatoff
 +0x4c
 _cd9660_lookup(f9a2dda8,f86fce80,f9a2de64,f9a2de40,f86eb820) at _cd9660_lookup+
 0x3f7
 _lookup(f9a2de40,f7bfdaac,f8707d00,8,f8748000) at _lookup+0x257
 _namei(f9a2de40,f7bfdaac,f8707d00,8,f9a2df88) at _namei+0x16b
 _sys_lstat(f8707d00,f9a2df88,f9a2df80,0,f7bfdac8) at _sys_lstat+0x50
 _syscall() at _syscall+0x139
 --- syscall (number 190) ---
 0x10041fa3:
 db> x/x 0xf9a2903c
 0xf9a2903c:         f9a2ab5c
 db> trace 0xf9a2ab5c
 bpendsleep(f8729580,f86fce80,f9a2ab88,f810b8d2,f8729580) at bpendsleep
 bpendsleep(f8729580,8) at bpendsleep
 _cd9660_lock(f9a2ab98,ef2b,f81a96f0,f86fce80,f9a2ad48) at _cd9660_lock+0x22
 _vget(f86fce80,1,f8709b80,f9a2af0c,f9a2aef8) at _vget+0x87
 _cd9660_lookup(f9a2ad78,f8709b80,f9a2af0c,f9a2aee8,f8748420) at _cd9660_lookup+
 0x1f5
 _lookup(f9a2aee8,0,138c0,f9a2aee8,f8732980) at _lookup+0x257
 _namei(f9a2aee8,0,138c0,f8722d40,f874e000) at _namei+0x16b
 _vn_open(f9a2aee8,5,60,f7bfd990,f86c1b00) at _vn_open+0x17c
 _sys_open(f86c1b00,f9a2af88,f9a2af80,0,13880) at _sys_open+0x91
 _syscall() at _syscall+0x139
 --- syscall (number 5) ---
 0x10055383:
 db> c
State-Changed-From-To: open->closed 
State-Changed-By: bouyer 
State-Changed-When: Thu Dec 3 11:23:43 PST 1998 
State-Changed-Why:  
I can't reproduce it any more ... 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.