ChangeSet 1.1155.3.4, 2003/05/19 10:47:00-07:00, mdharm-usb@one-eyed-alien.net

[PATCH] USB: storage: generate BBB reset after abort

This patch forces the generation of a bulk-transport reset after a command
abort.  Careful reading of the bulk-only specification shows that a reset
must be done after an abort to get the host and target back into phase.


diff -Nru a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
--- a/drivers/usb/storage/transport.c	Tue May 20 17:25:29 2003
+++ b/drivers/usb/storage/transport.c	Tue May 20 17:25:29 2003
@@ -511,9 +511,8 @@
 	 * short-circuit all other processing
 	 */
 	if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
-		US_DEBUGP("-- transport indicates command was aborted\n");
-		srb->result = DID_ABORT << 16;
-		return;
+		US_DEBUGP("-- command was aborted\n");
+		goto Handle_Abort;
 	}
 
 	/* if there is a transport error, reset and don't auto-sense */
@@ -634,8 +633,7 @@
 
 		if (atomic_read(&us->sm_state) == US_STATE_ABORTING) {
 			US_DEBUGP("-- auto-sense aborted\n");
-			srb->result = DID_ABORT << 16;
-			return;
+			goto Handle_Abort;
 		}
 		if (temp_result != USB_STOR_TRANSPORT_GOOD) {
 			US_DEBUGP("-- auto-sense failure\n");
@@ -688,6 +686,15 @@
 	    (result == USB_STOR_TRANSPORT_GOOD) &&
 	    ((srb->sense_buffer[2] & 0xf) == 0x0))
 		srb->sense_buffer[0] = 0x0;
+	return;
+
+	/* abort processing: the bulk-only transport requires a reset
+	 * following an abort */
+	Handle_Abort:
+	srb->result = DID_ABORT << 16;
+	if (us->protocol == US_PR_BULK) {
+		us->transport_reset(us);
+	}
 }
 
 /* Abort the currently running scsi command or device reset.
