Subject: kern/2105: ncr5380sbc stumbles over reselect during selection
To: None <gnats-bugs@NetBSD.ORG>
From: None <ra!leo@marco.de>
List: netbsd-bugs
Date: 02/19/1996 09:08:17
>Number:         2105
>Category:       kern
>Synopsis:       ncr5380sbc stumbles over reselect during selection
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 21 04:50:06 1996
>Last-Modified:
>Originator:     Matthias Pfaller
>Organization:
leo@dachau.marco.de			in real life: Matthias Pfaller
marco GmbH, 85221 Dachau, Germany	tel: +49 8131 516142
>Release:        960209
>Environment:
	<machine, os, target, libraries (multiple lines)>
System: NetBSD klondike 1.1A NetBSD 1.1A (KLONDIKE) #48: Sun Feb 18 13:12:42 MET 1996 leo@klondike:/usr/src/sys/arch/pc532/compile/KLONDIKE pc532


>Description:
	When a reselection occours while a selection is in progress, the
	selection is aborted and the reconnecting request is handled.
	In this case sc_matrix[target][lun] should get reset to NULL, but
	it doesn't.
>How-To-Repeat:
	Try something like:
	# dd if=/dev/rsd0a of=/dev/null bs=32k &
	# dd if=/dev/rsd0b of=/dev/null bs=32k &
	# dd if=/dev/rsd1a of=/dev/null bs=32k &
	After a short period of time you won't be able to access one of the
	two disks (if you had reselect enabled).
>Fix:
	Apply the following patch to ncr5380sbc.c:
--- src/sys/dev/ic/ncr5380sbc.c.orig	Mon Feb 12 21:00:31 1996
+++ src/sys/dev/ic/ncr5380sbc.c	Sun Feb 18 13:11:24 1996
@@ -838,10 +838,10 @@
 			target = sc->sc_ring[i].sr_target;
 			lun = sc->sc_ring[i].sr_lun;
 			if (sc->sc_matrix[target][lun] == NULL) {
-			    sc->sc_matrix[target][lun] =
+				sc->sc_matrix[target][lun] =
 					sr = &sc->sc_ring[i];
-			    sc->sc_rr = i;
-			    break;
+				sc->sc_rr = i;
+				break;
 			}
 		}
 		i++;
@@ -877,6 +877,7 @@
 			sc->sc_state |= NCR_ABORTING;
 			sc->sc_msgpriq |= SEND_ABORT;
 		}
+		sc->sc_matrix[target][lun] = NULL;
 		sr = sc->sc_current;
 		xs = sr->sr_xs;
 		NCR_TRACE("sched: reselect, new sr=0x%x\n", (long)sr);

>Audit-Trail:
>Unformatted: