diff options
author | James Bottomley <James.Bottomley@steeleye.com> | 2006-07-02 11:06:28 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2006-07-02 12:17:19 -0400 |
commit | d6b0c53723753fc0cfda63f56735b225c43e1e9a (patch) | |
tree | 7ca09539e8b026b9ee2a885f391f8c5b13226a17 | |
parent | f58f8313a6f552d1e7889926a29f0cf91c02f55d (diff) |
[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: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/scsi_lib.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index bf5191f6aaa1..08af9aae7df3 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -920,22 +920,20 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes) | |||
920 | * Next deal with any sectors which we were able to correctly | 920 | * Next deal with any sectors which we were able to correctly |
921 | * handle. | 921 | * handle. |
922 | */ | 922 | */ |
923 | if (good_bytes > 0) { | 923 | SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, " |
924 | SCSI_LOG_HLCOMPLETE(1, printk("%ld sectors total, " | 924 | "%d bytes done.\n", |
925 | "%d bytes done.\n", | 925 | req->nr_sectors, good_bytes)); |
926 | req->nr_sectors, good_bytes)); | 926 | SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg)); |
927 | SCSI_LOG_HLCOMPLETE(1, printk("use_sg is %d\n", cmd->use_sg)); | 927 | |
928 | 928 | if (clear_errors) | |
929 | if (clear_errors) | 929 | req->errors = 0; |
930 | req->errors = 0; | 930 | |
931 | 931 | /* A number of bytes were successfully read. If there | |
932 | /* A number of bytes were successfully read. If there | 932 | * are leftovers and there is some kind of error |
933 | * is leftovers and there is some kind of error | 933 | * (result != 0), retry the rest. |
934 | * (result != 0), retry the rest. | 934 | */ |
935 | */ | 935 | if (scsi_end_request(cmd, 1, good_bytes, result == 0) == NULL) |
936 | if (scsi_end_request(cmd, 1, good_bytes, !!result) == NULL) | 936 | return; |
937 | return; | ||
938 | } | ||
939 | 937 | ||
940 | /* good_bytes = 0, or (inclusive) there were leftovers and | 938 | /* good_bytes = 0, or (inclusive) there were leftovers and |
941 | * result = 0, so scsi_end_request couldn't retry. | 939 | * result = 0, so scsi_end_request couldn't retry. |