NetBSD Problem Report #403
From gnats Mon Aug 8 12:37:37 1994
Received: from flip.informatik.tu-muenchen.de (root@flip.informatik.tu-muenchen.de [131.159.8.33]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id MAA02419 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 8 Aug 1994 12:37:30 -0700
Message-Id: <199408081937.VAA00713@flip.informatik.tu-muenchen.de>
Date: Mon, 8 Aug 1994 21:37:25 +0200
From: grossman@informatik.tu-muenchen.de
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: Sparc panics when a bad disk block is encountered
X-Send-Pr-Version: 3.2
>Number: 403
>Category: port-sparc
>Synopsis: Sparc panics when a bad disk block is encountered
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: gnats-admin (GNATS administrator)
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 08 13:05:03 +0000 1994
>Closed-Date: Sat Aug 13 09:08:48 +0000 1994
>Last-Modified:
>Originator: Rolf Grossmann
>Release: NetBSD 1.0_BETA
>Organization:
Technische Universitaet Muenchen
>Environment:
System: NetBSD flip 1.0_BETA NetBSD 1.0_BETA (TIGKI) #30: Mon Aug 8 20:38:56 MET DST 1994 grossman@flip:/usr/src/sys/arch/sparc/compile/TIGKI sparc
>Description:
If you try to read a file from the hard disk, that resides on a
bad sector, the kernel panics with the following messages:
sd0: sdintr scsi status 0x2 resid 0
sd0: scsi sense class 7, code 0, key 1, blk 1079344
sd0: retry 1
panic: espintr sq
I could finally track down the problem to sbus/esp.c:espicmd(), where
sc->sc_hba.hba_busy is incorrectly set to 0. A fix is included below.
(This might not be the way you'd like to fix this problem, but it
does what I need. As someone is rewriting the scsi code, this might
change anyway, but you probably don't want to have a kernel that
crashes right now ;) )
>How-To-Repeat:
This might be quite hard, as you probably won't have a disk that
has a bad block on it. But you can read the code and you'll probaly
see the problem.
>Fix:
*** /usr/src/sys/arch/sparc/sbus/esp.c.orig Mon Aug 8 19:29:17 1994
--- /usr/src/sys/arch/sparc/sbus/esp.c Mon Aug 8 19:32:28 1994
***************
*** 1036,1041 ****
--- 1036,1042 ----
register volatile struct dmareg *dma = sc->sc_dma;
register int r, s, wait;
register struct sq *sq;
+ register char old_busy;
/*
* Wait for any ongoing operation to complete.
***************
*** 1045,1050 ****
--- 1046,1052 ----
sc->sc_iwant = 1;
tsleep((caddr_t)&sc->sc_iwant, PRIBIO, "espicmd", 0);
}
+ old_busy = sc->sc_hba.hba_busy;
sc->sc_hba.hba_busy = 1;
splx(s);
***************
*** 1117,1123 ****
sc->sc_hba.hba_head = sq->sq_forw;
(*sq->sq_dgo)(sq->sq_dev, &sc->sc_cdbspace);
} else
! sc->sc_hba.hba_busy = 0;
splx(s);
return (r);
}
--- 1119,1125 ----
sc->sc_hba.hba_head = sq->sq_forw;
(*sq->sq_dgo)(sq->sq_dev, &sc->sc_cdbspace);
} else
! sc->sc_hba.hba_busy = old_busy;
splx(s);
return (r);
}
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: deraadt
State-Changed-When: Sat Aug 13 02:08:48 PDT 1994
State-Changed-Why:
well, perhaps it is fixed. who knows.
russ sent in a fix, and it might work. torek isn't that hopeful, saying
there are numerous bugs it might trigger.
In any case, soon this entire scsi subsystem will get tossed.
>Unformatted:
(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.