public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH block#for-2.6.31] scsi: fix resid_len mis-conversion in scsi_end_request()
@ 2009-05-12  2:15 Tejun Heo
  2009-05-12  6:49 ` Jens Axboe
  2009-05-12 11:31 ` FUJITA Tomonori
  0 siblings, 2 replies; 3+ messages in thread
From: Tejun Heo @ 2009-05-12  2:15 UTC (permalink / raw)
  To: Linux Kernel, linux-scsi, Jens Axboe, James Bottomley,
	Boaz Harrosh, FUJITA Tomonori

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.

Signed-off-by: Tejun Heo <tj@kernel.org>
Spotted-by: Boaz Harrosh <bharrosh@panasas.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 drivers/scsi/scsi_lib.c |    7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index a54bec9..e410d66 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -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) {
 				/*


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

* Re: [PATCH block#for-2.6.31] scsi: fix resid_len mis-conversion in scsi_end_request()
  2009-05-12  2:15 [PATCH block#for-2.6.31] scsi: fix resid_len mis-conversion in scsi_end_request() Tejun Heo
@ 2009-05-12  6:49 ` Jens Axboe
  2009-05-12 11:31 ` FUJITA Tomonori
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2009-05-12  6:49 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Linux Kernel, linux-scsi, James Bottomley, Boaz Harrosh,
	FUJITA Tomonori

On Tue, May 12 2009, Tejun Heo wrote:
> 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.

Added, thanks.

> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Spotted-by: Boaz Harrosh <bharrosh@panasas.com>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> ---
>  drivers/scsi/scsi_lib.c |    7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
> index a54bec9..e410d66 100644
> --- a/drivers/scsi/scsi_lib.c
> +++ b/drivers/scsi/scsi_lib.c
> @@ -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) {
>  				/*
> 

-- 
Jens Axboe


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

* Re: [PATCH block#for-2.6.31] scsi: fix resid_len mis-conversion in scsi_end_request()
  2009-05-12  2:15 [PATCH block#for-2.6.31] scsi: fix resid_len mis-conversion in scsi_end_request() Tejun Heo
  2009-05-12  6:49 ` Jens Axboe
@ 2009-05-12 11:31 ` FUJITA Tomonori
  1 sibling, 0 replies; 3+ messages in thread
From: FUJITA Tomonori @ 2009-05-12 11:31 UTC (permalink / raw)
  To: tj
  Cc: linux-kernel, linux-scsi, jens.axboe, James.Bottomley, bharrosh,
	fujita.tomonori

On Tue, 12 May 2009 11:15:22 +0900
Tejun Heo <tj@kernel.org> wrote:

> 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.
> 
> Signed-off-by: Tejun Heo <tj@kernel.org>
> Spotted-by: Boaz Harrosh <bharrosh@panasas.com>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
> ---
>  drivers/scsi/scsi_lib.c |    7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

Looks good to me.

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

end of thread, other threads:[~2009-05-12 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-12  2:15 [PATCH block#for-2.6.31] scsi: fix resid_len mis-conversion in scsi_end_request() Tejun Heo
2009-05-12  6:49 ` Jens Axboe
2009-05-12 11:31 ` FUJITA Tomonori

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