Greg, I'm jumping this patch forward in my patch queue for you.  It's
pretty important, as it fixes a quiet data corruption error.  Please apply.

Signed-off-by: Matthew Dharm <[EMAIL PROTECTED]>

Matt

----- Forwarded message from Alan Stern <[EMAIL PROTECTED]> -----

Date: Sun, 13 Jun 2004 13:45:58 -0400 (EDT)
From: Alan Stern <[EMAIL PROTECTED]>
Subject: PATCH: (as309) Patch to signal underflow in usb-storage driver

This patch causes the usb-storage driver to return an error indication
(DID_ERROR together with SUGGEST_RETRY) when the amount transferred by a
SCSI command is smaller than the "underflow" amount.  Some devices, like
the iRiver H100 series, occasionally transfer 0 bytes with GOOD status.  
This change will make the sd driver aware that something unexpected has
happened so it can retry the command.

Alan Stern



Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

===== drivers/usb/storage/transport.c 1.135 vs edited =====
--- 1.135/drivers/usb/storage/transport.c       Thu Jun  3 14:55:06 2004
+++ edited/drivers/usb/storage/transport.c      Tue Jun  8 15:48:37 2004
@@ -708,6 +708,12 @@
                        srb->sense_buffer[0] = 0x0;
                }
        }
+
+       /* Did we transfer less than the minimum amount required? */
+       if (srb->result == SAM_STAT_GOOD &&
+                       srb->request_bufflen - srb->resid < srb->underflow)
+               srb->result = (DID_ERROR << 16) | (SUGGEST_RETRY << 24);
+
        return;
 
        /* abort processing: the bulk-only transport requires a reset

----- End forwarded message -----

-- 
Matthew Dharm                              Home: [EMAIL PROTECTED] 
Maintainer, Linux USB Mass Storage Driver

Why am I talking to a toilet brush?
                                        -- CEO
User Friendly, 4/30/1998

Attachment: pgpo7tvzH1YjZ.pgp
Description: PGP signature

Reply via email to