PERFORCE change 155755 for review

Hans Petter Selasky hselasky at FreeBSD.org
Wed Jan 7 13:27:17 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=155755

Change 155755 by hselasky at hselasky_laptop001 on 2009/01/07 13:26:37

	
	Fix a race causing the explore thread to
	hang when tearing down USB transfers at
	detach.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#36 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb2/core/usb2_transfer.c#36 (text+ko) ====

@@ -1915,8 +1915,7 @@
 
 	/*
 	 * 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 @@
 		/* 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);


More information about the p4-projects mailing list