summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorJames Bottomley2008-09-20 02:31:50 +0200
committerJames Bottomley2008-09-23 21:29:01 +0200
commit44ea91c597ae4641d9ac21b8bbba0795d2f4261e (patch)
tree93a373ec24d3a290533bbcce1e7d038a6fb81179 /drivers/scsi/scsi_lib.c
parent[SCSI] qla2xxx: Defer enablement of RISC interrupts until ISP initialization ... (diff)
downloadkernel-qcow2-linux-44ea91c597ae4641d9ac21b8bbba0795d2f4261e.tar.gz
kernel-qcow2-linux-44ea91c597ae4641d9ac21b8bbba0795d2f4261e.tar.xz
kernel-qcow2-linux-44ea91c597ae4641d9ac21b8bbba0795d2f4261e.zip
[SCSI] Fix hang with split requests
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>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index ff5d56b3ee4d..62307bd794a9 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -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.