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/u...@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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to