scsi: fix resid_len mis-conversion in scsi_end_request()
PATCH 1/1 scsi: fix resid_len mis-conversion in scsi_end_request()
Commit c3a4d78c580de4edc9ef0f7c59812fb02ceb037f introduced rq->data_len and converted residual count users to it. While converting, it mistakenly converted scsi_end_request() to finish requests with residual count when it wants to do is fully complete the request. Fix it by using blk_end_request_all() instead.
This bug was spotted by Boaz Harrosh.
--- drivers/scsi/scsi_lib.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/scsi/scsi_lib.c +1 -6
@@ -546,14 +546,9 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error,* to queue the remainder of them. */ if (blk_end_request (req, error, bytes)) { -int leftover =blk_rq_bytes (req); - -if (blk_pc_request (req)) - leftover = req->resid_len; -/* kill remainder if no retrys */ if (error &&scsi_noretry_cmd (cmd)) -blk_end_request (req, error, leftover); +blk_end_request_all (req, error);else {if (requeue) {/*
Quoted 7 lines · Tejun Heo
Commit
c3a4d78c580de4edc9ef0f7c59812fb02ceb037fintroducedrq->data_lenand converted residual count users to it. While converting, it mistakenly convertedscsi_end_request()to finish requests with residual count when it wants to do is fully complete the request. Fix it by usingblk_end_request_all()instead.This bug was spotted by Boaz Harrosh.
Added, thanks.
Quoted 31 lines
Signed-off-by Tejun Heo <[email protected]>Spotted-by Boaz Harrosh <[email protected]>Cc Jens Axboe <[email protected]>Cc FUJITA Tomonori <[email protected]>Cc James Bottomley <[email protected]>--- drivers/scsi/scsi_lib.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)drivers/scsi/scsi_lib.c +1
-6@@ -546,14 +546,9 @@ static struct scsi_cmnd *scsi_end_request(struct scsi_cmnd *cmd, int error,* to queue the remainder of them. */ if (blk_end_request (req, error, bytes)) { -int leftover =blk_rq_bytes (req); - -if (blk_pc_request (req)) - leftover = req->resid_len; -/* kill remainder if no retrys */ if (error &&scsi_noretry_cmd (cmd)) -blk_end_request (req, error, leftover); +blk_end_request_all (req, error);else {if (requeue) {/*
Signature · 1 line
Jens Axboe
Quoted 8 lines · On Tue, 12 May 2009 11:15:22 +0900 Tejun Heo <[email protected]> wrote:
Commit
c3a4d78c580de4edc9ef0f7c59812fb02ceb037fintroducedrq->data_lenand converted residual count users to it. While converting, it mistakenly convertedscsi_end_request()to finish requests with residual count when it wants to do is fully complete the request. Fix it by usingblk_end_request_all()instead.This bug was spotted by Boaz Harrosh.
Quoted 8 lines
Signed-off-by Tejun Heo <[email protected]>Spotted-by Boaz Harrosh <[email protected]>Cc Jens Axboe <[email protected]>Cc FUJITA Tomonori <[email protected]>Cc James Bottomley <[email protected]>--- drivers/scsi/scsi_lib.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
Looks good to me.