Date: Tue, 13 Jan 2009 19:01:57 +0000 (UTC) From: Andrew Thompson <thompsa@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r187166 - head/sys/dev/usb2/core Message-ID: <200901131901.n0DJ1vkT012138@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: thompsa Date: Tue Jan 13 19:01:56 2009 New Revision: 187166 URL: http://svn.freebsd.org/changeset/base/187166 Log: MFp4: //depot/projects/usb@155755 Fix a race causing the explore thread to hang when tearing down USB transfers at detach. Submitted by: Hans Petter Selasky Modified: head/sys/dev/usb2/core/usb2_transfer.c Modified: head/sys/dev/usb2/core/usb2_transfer.c ============================================================================== --- head/sys/dev/usb2/core/usb2_transfer.c Tue Jan 13 19:01:46 2009 (r187165) +++ head/sys/dev/usb2/core/usb2_transfer.c Tue Jan 13 19:01:56 2009 (r187166) @@ -1915,8 +1915,7 @@ usb2_callback_wrapper(struct usb2_xfer_q /* * Check if we got started after that we got cancelled, but - * before we managed to do the callback. Check if we are - * draining. + * before we managed to do the callback. */ if ((!xfer->flags_int.open) && (xfer->flags_int.started) && @@ -1924,13 +1923,19 @@ usb2_callback_wrapper(struct usb2_xfer_q /* try to loop, but not recursivly */ usb2_command_wrapper(&info->done_q, xfer); return; - } else if (xfer->flags_int.draining && + } + +done: + /* + * Check if we are draining. + */ + if (xfer->flags_int.draining && (!xfer->flags_int.transferring)) { /* "usb2_transfer_drain()" is waiting for end of transfer */ xfer->flags_int.draining = 0; usb2_cv_broadcast(&xfer->usb2_root->cv_drain); } -done: + /* do the next callback, if any */ usb2_command_wrapper(&info->done_q, info->done_q.curr);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901131901.n0DJ1vkT012138>