Bug 40903

Summary: Busy_count is < 0 message keeps counting down
Product: Base System Reporter: Pat Lashley <patl+freebsd>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.6-STABLE   
Hardware: Any   
OS: Any   

Description Pat Lashley 2002-07-22 23:10:02 UTC
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.

Fix: I believe the following patch will prevent the hard loop as it tries to
count down from 0xffffffff to zero:



/* 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--B49BatIyp8LODuhjebezSLO7a94SJMBwu2iTx0YPobU3RW9S
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- 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 @@
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.
Comment 1 patl 2002-07-24 18:28:13 UTC
--On Monday, July 22, 2002 03:10:02 PM -0700 
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
Comment 2 Kris Kennaway freebsd_committer freebsd_triage 2003-07-14 11:32:55 UTC
State Changed
From-To: open->feedback

Does this problem persist in recent releases?
Comment 3 Kris Kennaway freebsd_committer freebsd_triage 2003-08-16 06:24:57 UTC
State Changed
From-To: feedback->closed

Feedback timeout