Subject: kern/5982: Locking error with LOCKDEBUG turned on
To: None <gnats-bugs@gnats.netbsd.org>
From: Stefan Grefen <grefen@hprc.tandem.com>
List: netbsd-bugs
Date: 08/17/1998 18:32:39
>Number:         5982
>Category:       kern
>Synopsis:       systems panic after fsck when LOCKDEBUG is defined
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Aug 17 10:05:02 1998
>Last-Modified:
>Originator:     Stefan Grefen
>Organization:
Stefan Grefen                                Tandem Computers Europe Inc.
grefen@hprc.tandem.com                       High Performance Research Center
 --- Hacking's just another word for nothing left to kludge. ---
>Release:        08/17/1998 <NetBSD-current source date>
>Environment:
NetBSD hicks 1.3G NetBSD 1.3G (CPQ) #29: Mon Aug 17 17:57:36 CEST 1998     grefen@hicks:/usr/src/sys/arch/i386/compile/CPQ i386
System: NetBSD hrriss 1.3B NetBSD 1.3B (HRRISS) #7: Wed Feb 11 18:47:17 GMT 1998 grefen@hrriss:/usr/src/sys/arch/i386/compile/HRRISS i386
>Description:
    After reboot with fsck the system issues a warning that a simplelock
    is a already held.
>How-To-Repeat:
	Don't try it, yet. The lockdebug code is broken. I'll send a fix
	ASAP
	
>Fix:
*** /usr/sup/src/sys/kern/vfs_subr.c	Tue Aug  4 13:11:20 1998
--- vfs_subr.c	Sun Aug 16 11:51:43 1998
***************
*** 1033,1040 ****
  		 * vnodes open for writing.
  		 */
  		if ((flags & WRITECLOSE) &&
! 		    (vp->v_writecount == 0 || vp->v_type != VREG))
  			continue;
  		/*
  		 * With v_usecount == 0, all we need to do is clear
  		 * out the vnode data structures and we are done.
--- 1033,1043 ----
  		 * vnodes open for writing.
  		 */
  		if ((flags & WRITECLOSE) &&
! 		    (vp->v_writecount == 0 || vp->v_type != VREG)) {
! 			simple_unlock(&vp->v_interlock);
  			continue;
+ 		}
+ 
  		/*
  		 * With v_usecount == 0, all we need to do is clear
  		 * out the vnode data structures and we are done.
>Audit-Trail:
>Unformatted: