svn commit: r228760 - head/sys/dev/usb
Andriy Gapon
avg at FreeBSD.org
Wed Dec 21 10:52:18 UTC 2011
Author: avg
Date: Wed Dec 21 10:52:17 2011
New Revision: 228760
URL: http://svn.freebsd.org/changeset/base/228760
Log:
adapt usb transfer code for SCHEDULER_STOPPED
When SCHEDULER_STOPPED() is true the mtx_owned() call may return
an unexpected and thus meaningless result.
So, in the code paths that can be reached when SCHEDULER_STOPPED() is true
we need to protect the mtx_owned() calls with the SCHEDULER_STOPPED()
checks and ensure that an appropriate branch is taken in each case.
Reviewed by: hselasky
MFC after: 3 months
X-MFC after: r228424
Modified:
head/sys/dev/usb/usb_transfer.c
Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c Wed Dec 21 09:08:41 2011 (r228759)
+++ head/sys/dev/usb/usb_transfer.c Wed Dec 21 10:52:17 2011 (r228760)
@@ -2150,7 +2150,7 @@ usbd_callback_wrapper(struct usb_xfer_qu
struct usb_xfer_root *info = xfer->xroot;
USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED);
- if (!mtx_owned(info->xfer_mtx)) {
+ if (!mtx_owned(info->xfer_mtx) && !SCHEDULER_STOPPED()) {
/*
* Cases that end up here:
*
@@ -3119,14 +3119,14 @@ usbd_transfer_poll(struct usb_xfer **ppx
/* make sure that the BUS mutex is not locked */
drop_bus = 0;
- while (mtx_owned(&xroot->udev->bus->bus_mtx)) {
+ while (mtx_owned(&xroot->udev->bus->bus_mtx) && !SCHEDULER_STOPPED()) {
mtx_unlock(&xroot->udev->bus->bus_mtx);
drop_bus++;
}
/* make sure that the transfer mutex is not locked */
drop_xfer = 0;
- while (mtx_owned(xroot->xfer_mtx)) {
+ while (mtx_owned(xroot->xfer_mtx) && !SCHEDULER_STOPPED()) {
mtx_unlock(xroot->xfer_mtx);
drop_xfer++;
}
More information about the svn-src-head
mailing list