]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] Fix hang with split requests
authorJames Bottomley <James.Bottomley@HansenPartnership.com>
Sat, 20 Sep 2008 00:31:50 +0000 (00:31 +0000)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Tue, 23 Sep 2008 19:29:01 +0000 (12:29 -0700)
Sometimes, particularly for USB devices with the last sector bug,
requests get completed in chunks.  There's a bug in this in that if
one of the chunks gets an error, we complete that chunk with an error
but never move on to the remaining ones, leading to the request
hanging (because it's not fully completed).

Fix this by completing all remaining chunks if an error is encountered.

Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/scsi_lib.c

index ff5d56b3ee4d5c66a6ee4ab34609fc1800cd347b..62307bd794a924c1f04d6b6822aa61dd2ef875c3 100644 (file)
@@ -852,7 +852,7 @@ static void scsi_end_bidi_request(struct scsi_cmnd *cmd)
 void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
 {
        int result = cmd->result;
-       int this_count = scsi_bufflen(cmd);
+       int this_count;
        struct request_queue *q = cmd->device->request_queue;
        struct request *req = cmd->request;
        int error = 0;
@@ -908,6 +908,7 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
         */
        if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL)
                return;
+       this_count = blk_rq_bytes(req);
 
        /* good_bytes = 0, or (inclusive) there were leftovers and
         * result = 0, so scsi_end_request couldn't retry.