Skip to content

Commit

Permalink
scsi: fix resid_len mis-conversion in scsi_end_request()
Browse files Browse the repository at this point in the history
Commit c3a4d78 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.

Signed-off-by: Tejun Heo <tj@kernel.org>
Spotted-by: Boaz Harrosh <bharrosh@panasas.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Tejun Heo authored and Jens Axboe committed May 12, 2009
1 parent 0b0a47f commit e458824
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
/*
Expand Down

0 comments on commit e458824

Please sign in to comment.