Commit d6b0c537 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley
Browse files

[SCSI] fix error handling in scsi_io_completion



There was a logic fault in scsi_io_completion() where zero transfer
commands that complete successfully were sent to the block layer as
not up to date.  This patch removes the if (good_bytes > 0) gate
around the successful completion, since zero transfer commands do have
good_bytes == 0.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent f58f8313
...@@ -920,22 +920,20 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) ...@@ -920,22 +920,20 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
* Next deal with any sectors which we were able to correctly * Next deal with any sectors which we were able to correctly
* handle. * handle.
*/ */
if (good_bytes > 0) { SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, "
SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, " "%d bytes done.\n",
"%d bytes done.\n", req->nr_sectors, good_bytes));
req->nr_sectors, good_bytes)); SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg));
SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg));
if (clear_errors)
if (clear_errors) req->errors = 0;
req->errors = 0;
/* A number of bytes were successfully read. If there
/* A number of bytes were successfully read. If there * are leftovers and there is some kind of error
* is leftovers and there is some kind of error * (result != 0), retry the rest.
* (result != 0), retry the rest. */
*/ if (scsi_end_request(cmd, 1, good_bytes, result == 0) == NULL)
if (scsi_end_request(cmd, 1, good_bytes, !!result) == NULL) return;
return;
}
/* good_bytes = 0, or (inclusive) there were leftovers and /* good_bytes = 0, or (inclusive) there were leftovers and
* result = 0, so scsi_end_request couldn't retry. * result = 0, so scsi_end_request couldn't retry.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment