diff options
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r-- | drivers/scsi/scsi_error.c | 42 |
1 files changed, 17 insertions, 25 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 2bf1ee2b47b6..ceb4e0c99b37 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -434,8 +434,7 @@ static void scsi_eh_times_out(struct scsi_cmnd *scmd) | |||
434 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd:%p\n", __FUNCTION__, | 434 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: scmd:%p\n", __FUNCTION__, |
435 | scmd)); | 435 | scmd)); |
436 | 436 | ||
437 | if (scmd->device->host->eh_action) | 437 | up(scmd->device->host->eh_action); |
438 | up(scmd->device->host->eh_action); | ||
439 | } | 438 | } |
440 | 439 | ||
441 | /** | 440 | /** |
@@ -457,8 +456,7 @@ static void scsi_eh_done(struct scsi_cmnd *scmd) | |||
457 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n", | 456 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s scmd: %p result: %x\n", |
458 | __FUNCTION__, scmd, scmd->result)); | 457 | __FUNCTION__, scmd, scmd->result)); |
459 | 458 | ||
460 | if (scmd->device->host->eh_action) | 459 | up(scmd->device->host->eh_action); |
461 | up(scmd->device->host->eh_action); | ||
462 | } | 460 | } |
463 | } | 461 | } |
464 | 462 | ||
@@ -528,10 +526,8 @@ static int scsi_send_eh_cmnd(struct scsi_cmnd *scmd, int timeout) | |||
528 | * abort a timed out command or not. not sure how | 526 | * abort a timed out command or not. not sure how |
529 | * we should treat them differently anyways. | 527 | * we should treat them differently anyways. |
530 | */ | 528 | */ |
531 | spin_lock_irqsave(shost->host_lock, flags); | ||
532 | if (shost->hostt->eh_abort_handler) | 529 | if (shost->hostt->eh_abort_handler) |
533 | shost->hostt->eh_abort_handler(scmd); | 530 | shost->hostt->eh_abort_handler(scmd); |
534 | spin_unlock_irqrestore(shost->host_lock, flags); | ||
535 | 531 | ||
536 | scmd->request->rq_status = RQ_SCSI_DONE; | 532 | scmd->request->rq_status = RQ_SCSI_DONE; |
537 | scmd->owner = SCSI_OWNER_ERROR_HANDLER; | 533 | scmd->owner = SCSI_OWNER_ERROR_HANDLER; |
@@ -737,11 +733,8 @@ static int scsi_eh_get_sense(struct list_head *work_q, | |||
737 | **/ | 733 | **/ |
738 | static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) | 734 | static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) |
739 | { | 735 | { |
740 | unsigned long flags; | ||
741 | int rtn = FAILED; | ||
742 | |||
743 | if (!scmd->device->host->hostt->eh_abort_handler) | 736 | if (!scmd->device->host->hostt->eh_abort_handler) |
744 | return rtn; | 737 | return FAILED; |
745 | 738 | ||
746 | /* | 739 | /* |
747 | * scsi_done was called just after the command timed out and before | 740 | * scsi_done was called just after the command timed out and before |
@@ -752,11 +745,7 @@ static int scsi_try_to_abort_cmd(struct scsi_cmnd *scmd) | |||
752 | 745 | ||
753 | scmd->owner = SCSI_OWNER_LOWLEVEL; | 746 | scmd->owner = SCSI_OWNER_LOWLEVEL; |
754 | 747 | ||
755 | spin_lock_irqsave(scmd->device->host->host_lock, flags); | 748 | return scmd->device->host->hostt->eh_abort_handler(scmd); |
756 | rtn = scmd->device->host->hostt->eh_abort_handler(scmd); | ||
757 | spin_unlock_irqrestore(scmd->device->host->host_lock, flags); | ||
758 | |||
759 | return rtn; | ||
760 | } | 749 | } |
761 | 750 | ||
762 | /** | 751 | /** |
@@ -770,6 +759,7 @@ static int scsi_eh_tur(struct scsi_cmnd *scmd) | |||
770 | { | 759 | { |
771 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; | 760 | static unsigned char tur_command[6] = {TEST_UNIT_READY, 0, 0, 0, 0, 0}; |
772 | int retry_cnt = 1, rtn; | 761 | int retry_cnt = 1, rtn; |
762 | int saved_result; | ||
773 | 763 | ||
774 | retry_tur: | 764 | retry_tur: |
775 | memcpy(scmd->cmnd, tur_command, sizeof(tur_command)); | 765 | memcpy(scmd->cmnd, tur_command, sizeof(tur_command)); |
@@ -780,6 +770,7 @@ retry_tur: | |||
780 | */ | 770 | */ |
781 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | 771 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); |
782 | 772 | ||
773 | saved_result = scmd->result; | ||
783 | scmd->request_buffer = NULL; | 774 | scmd->request_buffer = NULL; |
784 | scmd->request_bufflen = 0; | 775 | scmd->request_bufflen = 0; |
785 | scmd->use_sg = 0; | 776 | scmd->use_sg = 0; |
@@ -794,6 +785,7 @@ retry_tur: | |||
794 | * the original request, so let's restore the original data. (db) | 785 | * the original request, so let's restore the original data. (db) |
795 | */ | 786 | */ |
796 | scsi_setup_cmd_retry(scmd); | 787 | scsi_setup_cmd_retry(scmd); |
788 | scmd->result = saved_result; | ||
797 | 789 | ||
798 | /* | 790 | /* |
799 | * hey, we are done. let's look to see what happened. | 791 | * hey, we are done. let's look to see what happened. |
@@ -865,17 +857,14 @@ static int scsi_eh_abort_cmds(struct list_head *work_q, | |||
865 | **/ | 857 | **/ |
866 | static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) | 858 | static int scsi_try_bus_device_reset(struct scsi_cmnd *scmd) |
867 | { | 859 | { |
868 | unsigned long flags; | 860 | int rtn; |
869 | int rtn = FAILED; | ||
870 | 861 | ||
871 | if (!scmd->device->host->hostt->eh_device_reset_handler) | 862 | if (!scmd->device->host->hostt->eh_device_reset_handler) |
872 | return rtn; | 863 | return FAILED; |
873 | 864 | ||
874 | scmd->owner = SCSI_OWNER_LOWLEVEL; | 865 | scmd->owner = SCSI_OWNER_LOWLEVEL; |
875 | 866 | ||
876 | spin_lock_irqsave(scmd->device->host->host_lock, flags); | ||
877 | rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd); | 867 | rtn = scmd->device->host->hostt->eh_device_reset_handler(scmd); |
878 | spin_unlock_irqrestore(scmd->device->host->host_lock, flags); | ||
879 | 868 | ||
880 | if (rtn == SUCCESS) { | 869 | if (rtn == SUCCESS) { |
881 | scmd->device->was_reset = 1; | 870 | scmd->device->was_reset = 1; |
@@ -896,6 +885,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
896 | { | 885 | { |
897 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; | 886 | static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; |
898 | int rtn; | 887 | int rtn; |
888 | int saved_result; | ||
899 | 889 | ||
900 | if (!scmd->device->allow_restart) | 890 | if (!scmd->device->allow_restart) |
901 | return 1; | 891 | return 1; |
@@ -908,6 +898,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
908 | */ | 898 | */ |
909 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); | 899 | memset(scmd->sense_buffer, 0, sizeof(scmd->sense_buffer)); |
910 | 900 | ||
901 | saved_result = scmd->result; | ||
911 | scmd->request_buffer = NULL; | 902 | scmd->request_buffer = NULL; |
912 | scmd->request_bufflen = 0; | 903 | scmd->request_bufflen = 0; |
913 | scmd->use_sg = 0; | 904 | scmd->use_sg = 0; |
@@ -922,6 +913,7 @@ static int scsi_eh_try_stu(struct scsi_cmnd *scmd) | |||
922 | * the original request, so let's restore the original data. (db) | 913 | * the original request, so let's restore the original data. (db) |
923 | */ | 914 | */ |
924 | scsi_setup_cmd_retry(scmd); | 915 | scsi_setup_cmd_retry(scmd); |
916 | scmd->result = saved_result; | ||
925 | 917 | ||
926 | /* | 918 | /* |
927 | * hey, we are done. let's look to see what happened. | 919 | * hey, we are done. let's look to see what happened. |
@@ -1061,9 +1053,7 @@ static int scsi_try_bus_reset(struct scsi_cmnd *scmd) | |||
1061 | if (!scmd->device->host->hostt->eh_bus_reset_handler) | 1053 | if (!scmd->device->host->hostt->eh_bus_reset_handler) |
1062 | return FAILED; | 1054 | return FAILED; |
1063 | 1055 | ||
1064 | spin_lock_irqsave(scmd->device->host->host_lock, flags); | ||
1065 | rtn = scmd->device->host->hostt->eh_bus_reset_handler(scmd); | 1056 | rtn = scmd->device->host->hostt->eh_bus_reset_handler(scmd); |
1066 | spin_unlock_irqrestore(scmd->device->host->host_lock, flags); | ||
1067 | 1057 | ||
1068 | if (rtn == SUCCESS) { | 1058 | if (rtn == SUCCESS) { |
1069 | if (!scmd->device->host->hostt->skip_settle_delay) | 1059 | if (!scmd->device->host->hostt->skip_settle_delay) |
@@ -1092,9 +1082,7 @@ static int scsi_try_host_reset(struct scsi_cmnd *scmd) | |||
1092 | if (!scmd->device->host->hostt->eh_host_reset_handler) | 1082 | if (!scmd->device->host->hostt->eh_host_reset_handler) |
1093 | return FAILED; | 1083 | return FAILED; |
1094 | 1084 | ||
1095 | spin_lock_irqsave(scmd->device->host->host_lock, flags); | ||
1096 | rtn = scmd->device->host->hostt->eh_host_reset_handler(scmd); | 1085 | rtn = scmd->device->host->hostt->eh_host_reset_handler(scmd); |
1097 | spin_unlock_irqrestore(scmd->device->host->host_lock, flags); | ||
1098 | 1086 | ||
1099 | if (rtn == SUCCESS) { | 1087 | if (rtn == SUCCESS) { |
1100 | if (!scmd->device->host->hostt->skip_settle_delay) | 1088 | if (!scmd->device->host->hostt->skip_settle_delay) |
@@ -1561,6 +1549,11 @@ static void scsi_eh_flush_done_q(struct list_head *done_q) | |||
1561 | scmd)); | 1549 | scmd)); |
1562 | scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); | 1550 | scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); |
1563 | } else { | 1551 | } else { |
1552 | /* | ||
1553 | * If just we got sense for the device (called | ||
1554 | * scsi_eh_get_sense), scmd->result is already | ||
1555 | * set, do not set DRIVER_TIMEOUT. | ||
1556 | */ | ||
1564 | if (!scmd->result) | 1557 | if (!scmd->result) |
1565 | scmd->result |= (DRIVER_TIMEOUT << 24); | 1558 | scmd->result |= (DRIVER_TIMEOUT << 24); |
1566 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish" | 1559 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: flush finish" |
@@ -1870,7 +1863,6 @@ scsi_reset_provider(struct scsi_device *dev, int flag) | |||
1870 | rtn = FAILED; | 1863 | rtn = FAILED; |
1871 | } | 1864 | } |
1872 | 1865 | ||
1873 | scsi_delete_timer(scmd); | ||
1874 | scsi_next_command(scmd); | 1866 | scsi_next_command(scmd); |
1875 | return rtn; | 1867 | return rtn; |
1876 | } | 1868 | } |