Module Name: src
Committed By: riastradh
Date: Sun Jun 24 07:48:01 UTC 2012
Modified Files:
src/sys/dev/scsipi: atapiconf.c
Log Message:
Take the kernel lock in atapibusdetach just like atapibuschilddet.
Fixes kassert in scsipi_lookup_periph when I press the power button
on one of my laptops (and maybe another one) to power it off.
ok mrg
To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/scsipi/atapiconf.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/atapiconf.c
diff -u src/sys/dev/scsipi/atapiconf.c:1.85 src/sys/dev/scsipi/atapiconf.c:1.86
--- src/sys/dev/scsipi/atapiconf.c:1.85 Thu Apr 19 17:45:20 2012
+++ src/sys/dev/scsipi/atapiconf.c Sun Jun 24 07:48:01 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: atapiconf.c,v 1.85 2012/04/19 17:45:20 bouyer Exp $ */
+/* $NetBSD: atapiconf.c,v 1.86 2012/06/24 07:48:01 riastradh Exp $ */
/*
* Copyright (c) 1996, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.85 2012/04/19 17:45:20 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atapiconf.c,v 1.86 2012/06/24 07:48:01 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -194,13 +194,16 @@ atapibusdetach(device_t self, int flags)
struct atapibus_softc *sc = device_private(self);
struct scsipi_channel *chan = sc->sc_channel;
struct scsipi_periph *periph;
- int target, error;
+ int target, error = 0;
/*
* Shut down the channel.
*/
scsipi_channel_shutdown(chan);
+ /* XXXSMP scsipi */
+ KERNEL_LOCK(1, curlwp);
+
/*
* Now detach all of the periphs.
*/
@@ -210,10 +213,14 @@ atapibusdetach(device_t self, int flags)
continue;
error = config_detach(periph->periph_dev, flags);
if (error)
- return (error);
+ goto out;
KASSERT(scsipi_lookup_periph(chan, target, 0) == NULL);
}
- return (0);
+
+out:
+ /* XXXSMP scsipi */
+ KERNEL_UNLOCK_ONE(curlwp);
+ return error;
}
static int