Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Take the kernel lock in atapibusdetach just l...
details: https://anonhg.NetBSD.org/src/rev/fdca9c8d3f0a
branches: trunk
changeset: 779870:fdca9c8d3f0a
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sun Jun 24 07:48:01 2012 +0000
description:
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
diffstat:
sys/dev/scsipi/atapiconf.c | 17 ++++++++++++-----
1 files changed, 12 insertions(+), 5 deletions(-)
diffs (53 lines):
diff -r 7501a0f1fb17 -r fdca9c8d3f0a sys/dev/scsipi/atapiconf.c
--- a/sys/dev/scsipi/atapiconf.c Sat Jun 23 23:41:25 2012 +0000
+++ b/sys/dev/scsipi/atapiconf.c Sun Jun 24 07:48:01 2012 +0000
@@ -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 @@
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 @@
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
Home |
Main Index |
Thread Index |
Old Index