NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/51641: locking error in scsipi

>Number:         51641
>Category:       kern
>Synopsis:       locking error in scsipi
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Nov 21 18:35:00 +0000 2016
>Originator:     Martin Husemann
>Release:        NetBSD 7.99.42
The NetBSD Foundation, Inc.
System: NetBSD 7.99.42 NetBSD 7.99.42 (MODULAR) #566: Mon Nov 21 19:20:57 CET 2016 sparc64
Architecture: sparc64
Machine: sparc64

With a LOCKDEBUG kernel I get assertion failures locking against myself.
The following patch, suggested by Nick Hudson, seems to fix it. Not sure
if other functions called from the event thread need similar treatment.

Index: scsipi_base.c
RCS file: /cvsroot/src/sys/dev/scsipi/scsipi_base.c,v
retrieving revision 1.167
diff -u -p -r1.167 scsipi_base.c
--- scsipi_base.c	20 Nov 2016 15:37:19 -0000	1.167
+++ scsipi_base.c	21 Nov 2016 18:27:03 -0000
@@ -2277,7 +2277,8 @@ scsipi_async_event_max_openings(struct s
 	/* XXX This could really suck with a large LUN space. */
 	for (; minlun <= maxlun; minlun++) {
-		periph = scsipi_lookup_periph(chan, mo->mo_target, minlun);
+		periph = scsipi_lookup_periph_locked(chan, mo->mo_target,
+		    minlun);
 		if (periph == NULL)

Boot a scsi system and use it. Without LOCKDEBUG it will hang hard easily,
with LOCKDEBUG a locking error in scsipi_lookup_periph will show up.


Home | Main Index | Thread Index | Old Index