]> err.no Git - linux-2.6/commitdiff
[PATCH] USB Storage: retry hard errors
authorMatthew Dharm <mdharm-usb@one-eyed-alien.net>
Tue, 7 Jun 2005 00:22:42 +0000 (17:22 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 27 Jun 2005 21:44:03 +0000 (14:44 -0700)
This patch started life as as527, and was rediffed by me.

Since the IDE interface doesn't convey much information about types of
errors, many USB-IDE adapters report all low-level errors with SK = 0x04,
which is supposed to be used only for non-recoverable errors.  As a result
the SCSI midlayer doesn't retry the command.  But quite often a retry
would succeed, whereas an unnecessary retry doesn't really hurt anything.

This patch uses a recently-implemented flag to tell the SCSI midlayer that
such hardware errors should be retried.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/storage/scsiglue.c

index da2bfa944b964a5e03ba9ed16d8e9ce155c9993e..af294bb68c35de7707a8f827a8463b32d3188ded 100644 (file)
@@ -155,6 +155,15 @@ static int slave_configure(struct scsi_device *sdev)
                 * If this device makes that mistake, tell the sd driver. */
                if (us->flags & US_FL_FIX_CAPACITY)
                        sdev->fix_capacity = 1;
+
+               /* USB-IDE bridges tend to report SK = 0x04 (Non-recoverable
+                * Hardware Error) when any low-level error occurs,
+                * recoverable or not.  Setting this flag tells the SCSI
+                * midlayer to retry such commands, which frequently will
+                * succeed and fix the error.  The worst this can lead to
+                * is an occasional series of retries that will all fail. */
+               sdev->retry_hwerror = 1;
+
        } else {
 
                /* Non-disk-type devices don't need to blacklist any pages