From olli@posbi.heim3.tu-clausthal.de  Fri May  9 04:24:34 1997
Received: from posbi.heim3.tu-clausthal.de (posbi.heim3.tu-clausthal.de [139.174.243.161])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA27947
          for <FreeBSD-gnats-submit@freebsd.org>; Fri, 9 May 1997 04:24:31 -0700 (PDT)
Received: (from root@localhost)
	by posbi.heim3.tu-clausthal.de (8.8.5/8.8.5) id NAA06853;
	Fri, 9 May 1997 13:24:18 +0200 (CEST)
Message-Id: <199705091124.NAA06853@posbi.heim3.tu-clausthal.de>
Date: Fri, 9 May 1997 13:24:18 +0200 (CEST)
From: oliver.fromme@heim3.tu-clausthal.de
Reply-To: oliver.fromme@heim3.tu-clausthal.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: Timeout counter bug in /sys/i386/isa/wd.c
X-Send-Pr-Version: 3.2

>Number:         3560
>Category:       kern
>Synopsis:       Timeout counter bug in /sys/i386/isa/wd.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May  9 06:20:01 PDT 1997
>Closed-Date:    Sun Apr 5 23:56:37 PDT 1998
>Last-Modified:  Sun Apr  5 23:56:58 PDT 1998
>Originator:     Oliver Fromme
>Release:        FreeBSD 2.2.1-RELEASE i386
>Organization:
Technical University of Clausthal, Heim 3
>Environment:

The problem affects the reporting of timeouts in the
IDE disk driver of FreeBSD 2.2.1-RELEASE.

>Description:

In file i386/isa/wd.c, function wdtimeout(), line 2080 (2.2.1-RELEASE):

		if(timeouts++ == 5)
			wderror((struct buf *)NULL, du,
   "Last time I say: interrupt timeout.  Probably a portable PC.");
		else if(timeouts++ < 5)
			wderror((struct buf *)NULL, du, "interrupt timeout");

The problem should be obvious:  The first wderror() ("Last time
I say: ...") is _never_ executed, because timeouts==5 is never
true at that location, since timeout is always incremented
_twice_ if it's != 5.  See the suggested fix below.

>How-To-Repeat:

Enable "IDE power down" in the BIOS, then boot FreeBSD 2.2.1
and wait until disk activity stops and the disk powers down (it
may be necessary to kill cron and other processes which access
the disk).  Then access some file.  During the power-up of the
disk, the kernel displays "interrupt timeout".  Repeat that
procedure twice.  On the third and subsequent repetition, no
more timeout messages are displayed.  In particular, "Last time
I say: ..." is never displayed.

>Fix:

Suggested fix (should also be obvious):

		if(timeouts++ == 5)
			wderror((struct buf *)NULL, du,
   "Last time I say: interrupt timeout.  Probably a portable PC.");
		else if(timeouts <= 5)
			wderror((struct buf *)NULL, du, "interrupt timeout");

Best regards
   Oliver Fromme  <oliver.fromme@heim3.tu-clausthal.de>
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: phk 
State-Changed-When: Sun Apr 5 23:56:37 PDT 1998 
State-Changed-Why:  
fixed in -current some time ago. 
>Unformatted:
