Subject: port-sparc/403: Sparc panics when a bad disk block is encountered
To: None <gnats-admin>
From: None <grossman@informatik.tu-muenchen.de>
List: netbsd-bugs
Date: 08/08/1994 13:05:03
>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: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Aug 8 13:05:03 1994
>Originator: Rolf Grossmann
>Organization:
Technische Universitaet Muenchen
>Release: NetBSD 1.0_BETA
>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);
}
>Audit-Trail:
>Unformatted:
------------------------------------------------------------------------------