From patl+freebsd@volant.org  Mon Jul 22 15:00:30 2002
Return-Path: <patl+freebsd@volant.org>
Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 816C637B400
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 Jul 2002 15:00:30 -0700 (PDT)
Received: from gate.volant.org (gate.volant.org [207.111.218.246])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 4444943E65
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 22 Jul 2002 15:00:29 -0700 (PDT)
	(envelope-from patl+freebsd@volant.org)
Received: from 216-55-134-176.dsl.san-diego.abac.net ([216.55.134.176] helo=[192.168.0.13])
	by gate.volant.org with asmtp (TLSv1:DES-CBC3-SHA:168)
	(Exim 3.33 #1)
	id 17WlEB-000P1b-00
	for FreeBSD-gnats-submit@freebsd.org; Mon, 22 Jul 2002 15:00:27 -0700
Message-Id: <132290000.1027375208@mccaffrey.phoenix.volant.org>
Date: Mon, 22 Jul 2002 15:00:08 -0700
From: Pat Lashley <patl+freebsd@volant.org>
To: FreeBSD-gnats-submit@freebsd.org
Subject: Busy_count is < 0 message keeps counting down

>Number:         40903
>Category:       kern
>Synopsis:       Busy_count is < 0 message keeps counting down
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 22 15:10:02 PDT 2002
>Closed-Date:    Fri Aug 15 22:25:06 PDT 2003
>Last-Modified:  Fri Aug 15 22:25:06 PDT 2003
>Originator:     Pat Lashley
>Release:        FreeBSD 4.6-STABLE i386
>Organization:
>Environment:
System: FreeBSD orwell.phoenix.volant.org 4.6-STABLE FreeBSD 4.6-STABLE #9: 
Mon Jun 24 14:21:35 PDT 2002 
root@orwell.phoenix.volant.org:/usr/obj/usr/src/sys/ORWELL i386


	
>Description:
Occasionally I find this machine in a loop emitting the message:

	"devstat_end_transaction: HELP!! busy_count for da0 is < 0 (*******)"

to the console.  The "*******" is a large negative number which counts down
with each iteration.  (Having apparently wrapped around from 0.)  Sometimes
it is da1 instead of da0.

It seems to me that this is probably actually two problems.  One is whatever
is causing the busy_count go negative and the other is that it continues to
decrement after going negative.
>How-To-Repeat:
I haven't been able to determine what triggers it - any preceeding message
has long since scrolled off the console; and it doesn't leave any traces in
the logs.  It appears to happen early in the morning, generally when the
daily periodic scripts are running; and often, but not always, while the
nightly backups are running, though not necessarily accessing those disks.
(This machine is the backup server for my LAN.)

Da0 and da1 are Maxtor USB disks, the bulk of which are configured as a
RAID mirror via vinum.  (Don't ask.)  There is also an IDE disk and an
Adaptec 29160 attached to an Exabyte EZ17 tape library with a Mamoth drive.
>Fix:
I believe the following patch will prevent the hard loop as it tries to
count down from 0xffffffff to zero:

--- subr_devstat.c.~1~	Wed Aug  2 17:09:32 2000
+++ subr_devstat.c	Mon Jul 22 11:02:48 2002
@@ -222,10 +222,12 @@

 		/* Add our busy time to the total busy time. */
 		timevaladd(&ds->busy_time, &busy_time);
-	} else if (ds->busy_count < 0)
+	} else if (ds->busy_count < 0) {
 		printf("devstat_end_transaction: HELP!! busy_count "
 		       "for %s%d is < 0 (%d)!\n", ds->device_name,
 		       ds->unit_number, ds->busy_count);
+		ds->busy_count = 0 ;
+	}
 }

 void



>Release-Note:
>Audit-Trail:

From: PM Lashley <patl@phoenix.volant.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:  
Subject: Re: kern/40903: Busy_count is < 0 message keeps counting down
Date: Wed, 24 Jul 2002 10:28:13 -0700

 --==========3333109384==========
 Content-Type: text/plain; charset=us-ascii; format=flowed
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 --On Monday, July 22, 2002 03:10:02 PM -0700=20
 FreeBSD-gnats-submit@FreeBSD.org wrote:
 
 The patch submitted in my initial bug report does -NOT- ameliorate the
 symptom - it just makes each iteration report the count as -1.
 
 
 
 -Pat
 
 --==========3333109384==========
 Content-Type: application/pgp-signature
 Content-Transfer-Encoding: 7bit
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.0.7 (FreeBSD)
 
 iD8DBQE9PuOtncYNbLD8wuMRAhCMAKCk0GaeLmBPLJRQxlf0fQHobRjVBQCg+vaz
 nyMBVgiUtX/URe3qt3vtv+c=
 =Z70O
 -----END PGP SIGNATURE-----
 
 --==========3333109384==========--
 
State-Changed-From-To: open->feedback 
State-Changed-By: kris 
State-Changed-When: Mon Jul 14 03:32:55 PDT 2003 
State-Changed-Why:  
Does this problem persist in recent releases? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40903 
State-Changed-From-To: feedback->closed 
State-Changed-By: kris 
State-Changed-When: Fri Aug 15 22:24:57 PDT 2003 
State-Changed-Why:  
Feedback timeout 

http://www.freebsd.org/cgi/query-pr.cgi?pr=40903 
>Unformatted:
