Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/scsipi Fixup previous.
details: https://anonhg.NetBSD.org/src/rev/8b157dfab064
branches: trunk
changeset: 764525:8b157dfab064
user: hannken <hannken%NetBSD.org@localhost>
date: Tue Apr 26 07:41:18 2011 +0000
description:
Fixup previous.
The bug was in scsibusdetach(), which is not doing things in the proper
order: it has to detach its children and check for error. If no error,
then it can release the resources that the children were using.
>From David Young via source-changes-d.
diffstat:
sys/dev/scsipi/scsiconf.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diffs (66 lines):
diff -r 807e4c317e59 -r 8b157dfab064 sys/dev/scsipi/scsiconf.c
--- a/sys/dev/scsipi/scsiconf.c Mon Apr 25 23:14:33 2011 +0000
+++ b/sys/dev/scsipi/scsiconf.c Tue Apr 26 07:41:18 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: scsiconf.c,v 1.261 2011/04/25 14:14:22 hannken Exp $ */
+/* $NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken 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.261 2011/04/25 14:14:22 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scsiconf.c,v 1.262 2011/04/26 07:41:18 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -256,11 +256,20 @@
struct scsipi_xfer *xs;
int error;
+ /*
+ * Detach all of the periphs.
+ */
+ if ((error = scsipi_target_detach(chan, -1, -1, flags)) != 0)
+ return error;
+
pmf_device_deregister(self);
/*
* Process outstanding commands (which will never complete as the
* controller is gone).
+ *
+ * XXX Surely this is redundant? If we get this far, the
+ * XXX peripherals have all been detached.
*/
for (ctarget = 0; ctarget < chan->chan_ntargets; ctarget++) {
if (ctarget == chan->chan_id)
@@ -269,8 +278,6 @@
periph = scsipi_lookup_periph(chan, ctarget, clun);
if (periph == NULL)
continue;
- if ((flags & DETACH_SHUTDOWN) != 0)
- return EBUSY;
TAILQ_FOREACH(xs, &periph->periph_xferq, device_q) {
callout_stop(&xs->xs_callout);
xs->error = XS_DRIVER_STUFFUP;
@@ -280,16 +287,10 @@
}
/*
- * Detach all of the periphs.
- */
- error = scsipi_target_detach(chan, -1, -1, flags);
-
- /*
* Now shut down the channel.
- * XXX only if no errors ?
*/
scsipi_channel_shutdown(chan);
- return (error);
+ return 0;
}
/*
Home |
Main Index |
Thread Index |
Old Index