public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] SCSI: make use of the residue value
@ 2008-02-27 20:25 Alan Stern
  2008-03-08  0:17 ` James Bottomley
  0 siblings, 1 reply; 17+ messages in thread
From: Alan Stern @ 2008-02-27 20:25 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI development list

On 20 Feb 2008, Alan Stern wrote:

> This patch (as1036) causes the SCSI midlayer to take into account the
> residue value provided by some low-level drivers.  There's at least
> one situation (USB mass storage with the Bulk-only transport) where
> the specification states that it is permissible for a device to
> indicate some of the data was not transferred correctly merely by
> setting the residue value, without issuing a Check Condition.

After a week, there hasn't been any feedback on this patch.  Has it
been accepted?  Is there anything wrong with it?  Is it still on a
"to-look-at" queue?

Alan Stern


^ permalink raw reply	[flat|nested] 17+ messages in thread
* [PATCH] SCSI: make use of the residue value
@ 2008-02-20 21:26 Alan Stern
  0 siblings, 0 replies; 17+ messages in thread
From: Alan Stern @ 2008-02-20 21:26 UTC (permalink / raw)
  To: James Bottomley; +Cc: Boaz Harrosh, SCSI development list

This patch (as1036) causes the SCSI midlayer to take into account the
residue value provided by some low-level drivers.  There's at least
one situation (USB mass storage with the Bulk-only transport) where
the specification states that it is permissible for a device to
indicate some of the data was not transferred correctly merely by
setting the residue value, without issuing a Check Condition.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Boaz Harrosh <bharrosh@panasas.com>

---

Index: usb-2.6/drivers/scsi/scsi.c
===================================================================
--- usb-2.6.orig/drivers/scsi/scsi.c
+++ usb-2.6/drivers/scsi/scsi.c
@@ -732,6 +732,7 @@ void scsi_finish_command(struct scsi_cmn
 	struct Scsi_Host *shost = sdev->host;
 	struct scsi_driver *drv;
 	unsigned int good_bytes;
+	unsigned int non_residue_bytes;
 
 	scsi_device_unbusy(sdev);
 
@@ -758,11 +759,16 @@ void scsi_finish_command(struct scsi_cmn
 				"(result %x)\n", cmd->result));
 
 	good_bytes = scsi_bufflen(cmd);
+	non_residue_bytes = good_bytes - scsi_get_resid(cmd);
         if (cmd->request->cmd_type != REQ_TYPE_BLOCK_PC) {
 		drv = scsi_cmd_to_driver(cmd);
 		if (drv->done)
 			good_bytes = drv->done(cmd);
 	}
+
+	/* If the device sent a meaningful residue, accept it. */
+	if (unlikely(non_residue_bytes < good_bytes))
+		good_bytes = non_residue_bytes;
 	scsi_io_completion(cmd, good_bytes);
 }
 EXPORT_SYMBOL(scsi_finish_command);


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-05-23 21:00 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-27 20:25 [PATCH] SCSI: make use of the residue value Alan Stern
2008-03-08  0:17 ` James Bottomley
2008-03-08 16:22   ` Alan Stern
2008-03-08 17:20     ` James Bottomley
2008-03-08 22:35       ` Alan Stern
2008-03-09  0:24         ` James Bottomley
2008-03-09  3:05           ` Alan Stern
2008-03-09 14:44             ` James Bottomley
2008-03-09 19:13               ` Alan Stern
2008-03-09 19:34                 ` James Bottomley
2008-03-09 21:50                   ` Alan Stern
2008-03-10 13:42                     ` Boaz Harrosh
2008-03-10 14:11                       ` Alan Stern
2008-03-10 14:31                         ` Boaz Harrosh
2008-03-10 14:50                           ` Alan Stern
2008-05-23 21:00           ` Alan Stern
  -- strict thread matches above, loose matches on Subject: below --
2008-02-20 21:26 Alan Stern

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox