All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <mikenc@us.ibm.com>
To: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: [PATCH] fix leftover bytes calculation
Date: Thu, 11 Mar 2004 15:54:53 -0800	[thread overview]
Message-ID: <4050FC4D.4060002@us.ibm.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 792 bytes --]

If there are leftovers __end_that_request_first will call
blk_recalc_rq_sector to set req->hard_nr_sectors correctly.
For failfast, by subtracting bytes from the updated
req->hard_nr_sectors and then calling end_that_request_chunk
and end_that_request_last, you can end up with a bio that
never gets completed.

The attached patch built against 2.6.4 does not subtract
bytes for non-blk_pc_requests.


On a related note I was wondering if the following is a
bug or feature. At the bottom of scsi_io_completion, it calls
scsi_end_request on the bytes for the current buffer.
The comments indicate this is to handle improperly reported
medium errors, but commands scsi_decide_disposition
determined should not be retried end up getting
requeued minus the current buffer.

Thanks

Mike Christie

[-- Attachment #2: calc-leftover.patch --]
[-- Type: text/plain, Size: 488 bytes --]

--- linux-2.6.4-work/drivers/scsi/scsi_lib.c	2004-03-10 18:55:27.000000000 -0800
+++ linux-2.6.4-scsi/drivers/scsi/scsi_lib.c	2004-03-11 15:25:11.722261524 -0800
@@ -504,7 +504,7 @@ static struct scsi_cmnd *scsi_end_reques
 	 * to queue the remainder of them.
 	 */
 	if (end_that_request_chunk(req, uptodate, bytes)) {
-		int leftover = (req->hard_nr_sectors << 9) - bytes;
+		int leftover = req->hard_nr_sectors << 9;
 
 		if (blk_pc_request(req))
 			leftover = req->data_len - bytes;

             reply	other threads:[~2004-03-11 23:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-11 23:54 Mike Christie [this message]
2004-03-12  0:01 ` [PATCH] fix leftover bytes calculation Mike Christie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4050FC4D.4060002@us.ibm.com \
    --to=mikenc@us.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.