Module Name: src
Committed By: jakllsch
Date: Sun May 13 01:03:13 UTC 2012
Modified Files:
src/sys/dev/scsipi: scsiconf.c
Log Message:
Fix locking issue triggered by drvctr -r of a scsibus(4).
Pullup to netbsd-6 should be requested.
To generate a diff of this commit:
cvs rdiff -u -r1.267 -r1.268 src/sys/dev/scsipi/scsiconf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/scsipi/scsiconf.c
diff -u src/sys/dev/scsipi/scsiconf.c:1.267 src/sys/dev/scsipi/scsiconf.c:1.268
--- src/sys/dev/scsipi/scsiconf.c:1.267 Fri Apr 20 20:23:21 2012
+++ src/sys/dev/scsipi/scsiconf.c Sun May 13 01:03:13 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: scsiconf.c,v 1.267 2012/04/20 20:23:21 bouyer Exp $ */
+/* $NetBSD: scsiconf.c,v 1.268 2012/05/13 01:03:13 jakllsch Exp $ */
/*-
* Copyright (c) 1998, 1999, 2004 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.267 2012/04/20 20:23:21 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.268 2012/05/13 01:03:13 jakllsch Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -344,6 +344,9 @@ scsi_probe_bus(struct scsibus_softc *sc,
int maxtarget, mintarget, maxlun, minlun;
int error;
+ /* XXXSMP scsipi */
+ KERNEL_LOCK(1, curlwp);
+
if (target == -1) {
maxtarget = chan->chan_ntargets - 1;
mintarget = 0;
@@ -371,7 +374,7 @@ scsi_probe_bus(struct scsibus_softc *sc,
0, curproc);
if ((error = scsipi_adapter_addref(chan->chan_adapter)) != 0)
- return (error);
+ goto ret;
for (target = mintarget; target <= maxtarget; target++) {
if (target == chan->chan_id)
continue;
@@ -392,7 +395,9 @@ scsi_probe_bus(struct scsibus_softc *sc,
scsipi_set_xfer_mode(chan, target, 1);
}
scsipi_adapter_delref(chan->chan_adapter);
- return (0);
+ret:
+ KERNEL_UNLOCK_ONE(curlwp);
+ return (error);
}
static int