Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/ata in atabus_detach(), shutdown the channel thread ...
details: https://anonhg.NetBSD.org/src/rev/5cd990d702da
branches: trunk
changeset: 995199:5cd990d702da
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Tue Dec 11 23:06:30 2018 +0000
description:
in atabus_detach(), shutdown the channel thread only after all the
children successfully detach; this is especially important for
atapibus, which needs the thread to execute commands
fixes hang on poweroff with root on ATAPI cd(4), reported by Christoph Badura
diffstat:
sys/dev/ata/ata.c | 23 ++++++++++++-----------
1 files changed, 12 insertions(+), 11 deletions(-)
diffs (51 lines):
diff -r a650094c9469 -r 5cd990d702da sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Tue Dec 11 23:02:19 2018 +0000
+++ b/sys/dev/ata/ata.c Tue Dec 11 23:06:30 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ata.c,v 1.146 2018/11/12 18:51:01 jdolecek Exp $ */
+/* $NetBSD: ata.c,v 1.147 2018/12/11 23:06:30 jdolecek Exp $ */
/*
* Copyright (c) 1998, 2001 Manuel Bouyer. All rights reserved.
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.146 2018/11/12 18:51:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.147 2018/12/11 23:06:30 jdolecek Exp $");
#include "opt_ata.h"
@@ -630,15 +630,6 @@
device_t dev = NULL;
int i, error = 0;
- /* Shutdown the channel. */
- ata_channel_lock(chp);
- chp->ch_flags |= ATACH_SHUTDOWN;
- while (chp->ch_thread != NULL) {
- cv_signal(&chp->ch_thr_idle);
- cv_wait(&chp->ch_thr_idle, &chp->ch_lock);
- }
- ata_channel_unlock(chp);
-
/*
* Detach atapibus and its children.
*/
@@ -673,6 +664,16 @@
KASSERT(chp->ch_drive[i].drive_type == 0);
}
}
+
+ /* Shutdown the channel. */
+ ata_channel_lock(chp);
+ chp->ch_flags |= ATACH_SHUTDOWN;
+ while (chp->ch_thread != NULL) {
+ cv_signal(&chp->ch_thr_idle);
+ cv_wait(&chp->ch_thr_idle, &chp->ch_lock);
+ }
+ ata_channel_unlock(chp);
+
atabus_free_drives(chp);
out:
Home |
Main Index |
Thread Index |
Old Index