diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/scsi_error.c | 57 |
1 files changed, 19 insertions, 38 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index e289b3238539..0fc8b48f052b 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c | |||
@@ -662,12 +662,10 @@ static void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, | |||
662 | static int scsi_eh_get_sense(struct list_head *work_q, | 662 | static int scsi_eh_get_sense(struct list_head *work_q, |
663 | struct list_head *done_q) | 663 | struct list_head *done_q) |
664 | { | 664 | { |
665 | struct list_head *lh, *lh_sf; | 665 | struct scsi_cmnd *scmd, *next; |
666 | struct scsi_cmnd *scmd; | ||
667 | int rtn; | 666 | int rtn; |
668 | 667 | ||
669 | list_for_each_safe(lh, lh_sf, work_q) { | 668 | list_for_each_entry_safe(scmd, next, work_q, eh_entry) { |
670 | scmd = list_entry(lh, struct scsi_cmnd, eh_entry); | ||
671 | if ((scmd->eh_eflags & SCSI_EH_CANCEL_CMD) || | 669 | if ((scmd->eh_eflags & SCSI_EH_CANCEL_CMD) || |
672 | SCSI_SENSE_VALID(scmd)) | 670 | SCSI_SENSE_VALID(scmd)) |
673 | continue; | 671 | continue; |
@@ -798,12 +796,10 @@ retry_tur: | |||
798 | static int scsi_eh_abort_cmds(struct list_head *work_q, | 796 | static int scsi_eh_abort_cmds(struct list_head *work_q, |
799 | struct list_head *done_q) | 797 | struct list_head *done_q) |
800 | { | 798 | { |
801 | struct list_head *lh, *lh_sf; | 799 | struct scsi_cmnd *scmd, *next; |
802 | struct scsi_cmnd *scmd; | ||
803 | int rtn; | 800 | int rtn; |
804 | 801 | ||
805 | list_for_each_safe(lh, lh_sf, work_q) { | 802 | list_for_each_entry_safe(scmd, next, work_q, eh_entry) { |
806 | scmd = list_entry(lh, struct scsi_cmnd, eh_entry); | ||
807 | if (!(scmd->eh_eflags & SCSI_EH_CANCEL_CMD)) | 803 | if (!(scmd->eh_eflags & SCSI_EH_CANCEL_CMD)) |
808 | continue; | 804 | continue; |
809 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: aborting cmd:" | 805 | SCSI_LOG_ERROR_RECOVERY(3, printk("%s: aborting cmd:" |
@@ -918,8 +914,7 @@ static int scsi_eh_stu(struct Scsi_Host *shost, | |||
918 | struct list_head *work_q, | 914 | struct list_head *work_q, |
919 | struct list_head *done_q) | 915 | struct list_head *done_q) |
920 | { | 916 | { |
921 | struct list_head *lh, *lh_sf; | 917 | struct scsi_cmnd *scmd, *stu_scmd, *next; |
922 | struct scsi_cmnd *scmd, *stu_scmd; | ||
923 | struct scsi_device *sdev; | 918 | struct scsi_device *sdev; |
924 | 919 | ||
925 | shost_for_each_device(sdev, shost) { | 920 | shost_for_each_device(sdev, shost) { |
@@ -940,8 +935,8 @@ static int scsi_eh_stu(struct Scsi_Host *shost, | |||
940 | if (!scsi_eh_try_stu(stu_scmd)) { | 935 | if (!scsi_eh_try_stu(stu_scmd)) { |
941 | if (!scsi_device_online(sdev) || | 936 | if (!scsi_device_online(sdev) || |
942 | !scsi_eh_tur(stu_scmd)) { | 937 | !scsi_eh_tur(stu_scmd)) { |
943 | list_for_each_safe(lh, lh_sf, work_q) { | 938 | list_for_each_entry_safe(scmd, next, |
944 | scmd = list_entry(lh, struct scsi_cmnd, eh_entry); | 939 | work_q, eh_entry) { |
945 | if (scmd->device == sdev) | 940 | if (scmd->device == sdev) |
946 | scsi_eh_finish_cmd(scmd, done_q); | 941 | scsi_eh_finish_cmd(scmd, done_q); |
947 | } | 942 | } |
@@ -972,8 +967,7 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, | |||
972 | struct list_head *work_q, | 967 | struct list_head *work_q, |
973 | struct list_head *done_q) | 968 | struct list_head *done_q) |
974 | { | 969 | { |
975 | struct list_head *lh, *lh_sf; | 970 | struct scsi_cmnd *scmd, *bdr_scmd, *next; |
976 | struct scsi_cmnd *scmd, *bdr_scmd; | ||
977 | struct scsi_device *sdev; | 971 | struct scsi_device *sdev; |
978 | int rtn; | 972 | int rtn; |
979 | 973 | ||
@@ -995,11 +989,8 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost, | |||
995 | if (rtn == SUCCESS) { | 989 | if (rtn == SUCCESS) { |
996 | if (!scsi_device_online(sdev) || | 990 | if (!scsi_device_online(sdev) || |
997 | !scsi_eh_tur(bdr_scmd)) { | 991 | !scsi_eh_tur(bdr_scmd)) { |
998 | list_for_each_safe(lh, lh_sf, | 992 | list_for_each_entry_safe(scmd, next, |
999 | work_q) { | 993 | work_q, eh_entry) { |
1000 | scmd = list_entry(lh, struct | ||
1001 | scsi_cmnd, | ||
1002 | eh_entry); | ||
1003 | if (scmd->device == sdev) | 994 | if (scmd->device == sdev) |
1004 | scsi_eh_finish_cmd(scmd, | 995 | scsi_eh_finish_cmd(scmd, |
1005 | done_q); | 996 | done_q); |
@@ -1082,9 +1073,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost, | |||
1082 | struct list_head *work_q, | 1073 | struct list_head *work_q, |
1083 | struct list_head *done_q) | 1074 | struct list_head *done_q) |
1084 | { | 1075 | { |
1085 | struct list_head *lh, *lh_sf; | 1076 | struct scsi_cmnd *scmd, *chan_scmd, *next; |
1086 | struct scsi_cmnd *scmd; | ||
1087 | struct scsi_cmnd *chan_scmd; | ||
1088 | unsigned int channel; | 1077 | unsigned int channel; |
1089 | int rtn; | 1078 | int rtn; |
1090 | 1079 | ||
@@ -1115,9 +1104,7 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost, | |||
1115 | channel)); | 1104 | channel)); |
1116 | rtn = scsi_try_bus_reset(chan_scmd); | 1105 | rtn = scsi_try_bus_reset(chan_scmd); |
1117 | if (rtn == SUCCESS) { | 1106 | if (rtn == SUCCESS) { |
1118 | list_for_each_safe(lh, lh_sf, work_q) { | 1107 | list_for_each_entry_safe(scmd, next, work_q, eh_entry) { |
1119 | scmd = list_entry(lh, struct scsi_cmnd, | ||
1120 | eh_entry); | ||
1121 | if (channel == scmd->device->channel) | 1108 | if (channel == scmd->device->channel) |
1122 | if (!scsi_device_online(scmd->device) || | 1109 | if (!scsi_device_online(scmd->device) || |
1123 | !scsi_eh_tur(scmd)) | 1110 | !scsi_eh_tur(scmd)) |
@@ -1142,9 +1129,8 @@ static int scsi_eh_bus_reset(struct Scsi_Host *shost, | |||
1142 | static int scsi_eh_host_reset(struct list_head *work_q, | 1129 | static int scsi_eh_host_reset(struct list_head *work_q, |
1143 | struct list_head *done_q) | 1130 | struct list_head *done_q) |
1144 | { | 1131 | { |
1132 | struct scsi_cmnd *scmd, *next; | ||
1145 | int rtn; | 1133 | int rtn; |
1146 | struct list_head *lh, *lh_sf; | ||
1147 | struct scsi_cmnd *scmd; | ||
1148 | 1134 | ||
1149 | if (!list_empty(work_q)) { | 1135 | if (!list_empty(work_q)) { |
1150 | scmd = list_entry(work_q->next, | 1136 | scmd = list_entry(work_q->next, |
@@ -1155,8 +1141,7 @@ static int scsi_eh_host_reset(struct list_head *work_q, | |||
1155 | 1141 | ||
1156 | rtn = scsi_try_host_reset(scmd); | 1142 | rtn = scsi_try_host_reset(scmd); |
1157 | if (rtn == SUCCESS) { | 1143 | if (rtn == SUCCESS) { |
1158 | list_for_each_safe(lh, lh_sf, work_q) { | 1144 | list_for_each_entry_safe(scmd, next, work_q, eh_entry) { |
1159 | scmd = list_entry(lh, struct scsi_cmnd, eh_entry); | ||
1160 | if (!scsi_device_online(scmd->device) || | 1145 | if (!scsi_device_online(scmd->device) || |
1161 | (!scsi_eh_try_stu(scmd) && !scsi_eh_tur(scmd)) || | 1146 | (!scsi_eh_try_stu(scmd) && !scsi_eh_tur(scmd)) || |
1162 | !scsi_eh_tur(scmd)) | 1147 | !scsi_eh_tur(scmd)) |
@@ -1180,11 +1165,9 @@ static int scsi_eh_host_reset(struct list_head *work_q, | |||
1180 | static void scsi_eh_offline_sdevs(struct list_head *work_q, | 1165 | static void scsi_eh_offline_sdevs(struct list_head *work_q, |
1181 | struct list_head *done_q) | 1166 | struct list_head *done_q) |
1182 | { | 1167 | { |
1183 | struct list_head *lh, *lh_sf; | 1168 | struct scsi_cmnd *scmd, *next; |
1184 | struct scsi_cmnd *scmd; | ||
1185 | 1169 | ||
1186 | list_for_each_safe(lh, lh_sf, work_q) { | 1170 | list_for_each_entry_safe(scmd, next, work_q, eh_entry) { |
1187 | scmd = list_entry(lh, struct scsi_cmnd, eh_entry); | ||
1188 | printk(KERN_INFO "scsi: Device offlined - not" | 1171 | printk(KERN_INFO "scsi: Device offlined - not" |
1189 | " ready after error recovery: host" | 1172 | " ready after error recovery: host" |
1190 | " %d channel %d id %d lun %d\n", | 1173 | " %d channel %d id %d lun %d\n", |
@@ -1512,12 +1495,10 @@ static void scsi_eh_ready_devs(struct Scsi_Host *shost, | |||
1512 | **/ | 1495 | **/ |
1513 | static void scsi_eh_flush_done_q(struct list_head *done_q) | 1496 | static void scsi_eh_flush_done_q(struct list_head *done_q) |
1514 | { | 1497 | { |
1515 | struct list_head *lh, *lh_sf; | 1498 | struct scsi_cmnd *scmd, *next; |
1516 | struct scsi_cmnd *scmd; | ||
1517 | 1499 | ||
1518 | list_for_each_safe(lh, lh_sf, done_q) { | 1500 | list_for_each_entry_safe(scmd, next, done_q, eh_entry) { |
1519 | scmd = list_entry(lh, struct scsi_cmnd, eh_entry); | 1501 | list_del_init(&scmd->eh_entry); |
1520 | list_del_init(lh); | ||
1521 | if (scsi_device_online(scmd->device) && | 1502 | if (scsi_device_online(scmd->device) && |
1522 | !blk_noretry_request(scmd->request) && | 1503 | !blk_noretry_request(scmd->request) && |
1523 | (++scmd->retries < scmd->allowed)) { | 1504 | (++scmd->retries < scmd->allowed)) { |