diff options
author | Patrick Mansfield <patmans@us.ibm.com> | 2005-05-16 20:42:15 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.(none)> | 2005-05-20 16:47:52 -0400 |
commit | 793698ce28e20f4736250a9766270368beae5668 (patch) | |
tree | 10792e002a1a8562945c3b0ad855deca95abb70c /drivers/scsi | |
parent | ad34ea2cc3845ef4dcd7d12fb0fa8484734bd672 (diff) |
[SCSI] saved and restore result for timed out commands
Save and restore the scmd->result, so that timed out commands do not
return the result of the TEST UNIT READY or the start/stop commands. Code
is already in place to save and restore the result for the request sense
case.
The previous version of this patch erroneously removed the "if" check,
instead add a comment as to why the "if" is needed.
Signed-off-by: Patrick Mansfield <patmans@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi')
-rw-r--r-- | drivers/scsi/scsi_error.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index cb789c35262c..113c02dbb2df 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -768,6 +768,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd) | |||
768 | { | 768 | { |
769 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; | 769 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; |
770 | int retry_cnt = 1, rtn; | 770 | int retry_cnt = 1, rtn; |
771 | int saved_result; | ||
771 | 772 | ||
772 | retry_tur: | 773 | retry_tur: |
773 | memcpy(scmd->cmnd, tur_command, sizeof(tur_command)); | 774 | memcpy(scmd->cmnd, tur_command, sizeof(tur_command)); |
@@ -778,6 +779,7 @@ retry_tur: | |||
778 | */ | 779 | */ |
779 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | 780 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); |
780 | 781 | ||
782 | saved_result = scmd->result; | ||
781 | scmd->request_buffer = NULL; | 783 | scmd->request_buffer = NULL; |
782 | scmd->request_bufflen = 0; | 784 | scmd->request_bufflen = 0; |
783 | scmd->use_sg = 0; | 785 | scmd->use_sg = 0; |
@@ -792,6 +794,7 @@ retry_tur: | |||
792 | * the original request, so let's restore the original data. (db) | 794 | * the original request, so let's restore the original data. (db) |
793 | */ | 795 | */ |
794 | scsi_setup_cmd_retry(scmd); | 796 | scsi_setup_cmd_retry(scmd); |
797 | scmd->result = saved_result; | ||
795 | 798 | ||
796 | /* | 799 | /* |
797 | * hey, we are done. let's look to see what happened. | 800 | * hey, we are done. let's look to see what happened. |
@@ -894,6 +897,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
894 | { | 897 | { |
895 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; | 898 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; |
896 | int rtn; | 899 | int rtn; |
900 | int saved_result; | ||
897 | 901 | ||
898 | if (!scmd->device->allow_restart) | 902 | if (!scmd->device->allow_restart) |
899 | return 1; | 903 | return 1; |
@@ -906,6 +910,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
906 | */ | 910 | */ |
907 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | 911 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); |
908 | 912 | ||
913 | saved_result = scmd->result; | ||
909 | scmd->request_buffer = NULL; | 914 | scmd->request_buffer = NULL; |
910 | scmd->request_bufflen = 0; | 915 | scmd->request_bufflen = 0; |
911 | scmd->use_sg = 0; | 916 | scmd->use_sg = 0; |
@@ -920,6 +925,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
920 | * the original request, so let's restore the original data. (db) | 925 | * the original request, so let's restore the original data. (db) |
921 | */ | 926 | */ |
922 | scsi_setup_cmd_retry(scmd); | 927 | scsi_setup_cmd_retry(scmd); |
928 | scmd->result = saved_result; | ||
923 | 929 | ||
924 | /* | 930 | /* |
925 | * hey, we are done. let's look to see what happened. | 931 | * hey, we are done. let's look to see what happened. |
@@ -1559,6 +1565,11 @@ static void scsi_eh_flush_done_q(struct list_head *done_q) | |||
1559 | scmd)); | 1565 | scmd)); |
1560 | scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); | 1566 | scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); |
1561 | } else { | 1567 | } else { |
1568 | /* | ||
1569 | * If just we got sense for the device (called | ||
1570 | * scsi_eh_get_sense), scmd->result is already | ||
1571 | * set, do not set DRIVER_TIMEOUT. | ||
1572 | */ | ||
1562 | if (!scmd->result) | 1573 | if (!scmd->result) |
1563 | scmd->result |= (DRIVER_TIMEOUT << 24); | 1574 | scmd->result |= (DRIVER_TIMEOUT << 24); |
1564 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish" | 1575 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish" |