aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_error.c
diff options
context:
space:
mode:
authorJames Bottomley <jbottomley@parallels.com>2013-11-11 07:44:53 -0500
committerJames Bottomley <JBottomley@Parallels.com>2013-12-19 10:39:02 -0500
commit2451079bc2ae1334058be8babd44be03ecfa7041 (patch)
tree6c1e7c36d47108fb094a8e97062b56fe573e16e8 /drivers/scsi/scsi_error.c
parent1a4049ddfdaa75db7c9927dbc4d991bd73f923a0 (diff)
[SCSI] Fix erratic device offline during EH
Commit 18a4d0a22ed6c54b67af7718c305cd010f09ddf8 (Handle disk devices which can not process medium access commands) was introduced to offline any device which cannot process medium access commands. However, commit 3eef6257de48ff84a5d98ca533685df8a3beaeb8 (Reduce error recovery time by reducing use of TURs) reduced the number of TURs by sending it only on the first failing command, which might or might not be a medium access command. So in combination this results in an erratic device offlining during EH; if the command where the TUR was sent upon happens to be a medium access command the device will be set offline, if not everything proceeds as normal. This patch moves the check to the final test, eliminating this problem. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r--drivers/scsi/scsi_error.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c
index e8bee9f0ad0f..67c001457cb8 100644
--- a/drivers/scsi/scsi_error.c
+++ b/drivers/scsi/scsi_error.c
@@ -941,12 +941,6 @@ retry:
941 941
942 scsi_eh_restore_cmnd(scmd, &ses); 942 scsi_eh_restore_cmnd(scmd, &ses);
943 943
944 if (scmd->request->cmd_type != REQ_TYPE_BLOCK_PC) {
945 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
946 if (sdrv->eh_action)
947 rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn);
948 }
949
950 return rtn; 944 return rtn;
951} 945}
952 946
@@ -964,6 +958,16 @@ static int scsi_request_sense(struct scsi_cmnd *scmd)
964 return scsi_send_eh_cmnd(scmd, NULL, 0, scmd->device->eh_timeout, ~0); 958 return scsi_send_eh_cmnd(scmd, NULL, 0, scmd->device->eh_timeout, ~0);
965} 959}
966 960
961static int scsi_eh_action(struct scsi_cmnd *scmd, int rtn)
962{
963 if (scmd->request->cmd_type != REQ_TYPE_BLOCK_PC) {
964 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd);
965 if (sdrv->eh_action)
966 rtn = sdrv->eh_action(scmd, rtn);
967 }
968 return rtn;
969}
970
967/** 971/**
968 * scsi_eh_finish_cmd - Handle a cmd that eh is finished with. 972 * scsi_eh_finish_cmd - Handle a cmd that eh is finished with.
969 * @scmd: Original SCSI cmd that eh has finished. 973 * @scmd: Original SCSI cmd that eh has finished.
@@ -1142,7 +1146,9 @@ static int scsi_eh_test_devices(struct list_head *cmd_list,
1142 1146
1143 list_for_each_entry_safe(scmd, next, cmd_list, eh_entry) 1147 list_for_each_entry_safe(scmd, next, cmd_list, eh_entry)
1144 if (scmd->device == sdev) { 1148 if (scmd->device == sdev) {
1145 if (finish_cmds) 1149 if (finish_cmds &&
1150 (try_stu ||
1151 scsi_eh_action(scmd, SUCCESS) == SUCCESS))
1146 scsi_eh_finish_cmd(scmd, done_q); 1152 scsi_eh_finish_cmd(scmd, done_q);
1147 else 1153 else
1148 list_move_tail(&scmd->eh_entry, work_q); 1154 list_move_tail(&scmd->eh_entry, work_q);
@@ -1283,7 +1289,8 @@ static int scsi_eh_stu(struct Scsi_Host *shost,
1283 !scsi_eh_tur(stu_scmd)) { 1289 !scsi_eh_tur(stu_scmd)) {
1284 list_for_each_entry_safe(scmd, next, 1290 list_for_each_entry_safe(scmd, next,
1285 work_q, eh_entry) { 1291 work_q, eh_entry) {
1286 if (scmd->device == sdev) 1292 if (scmd->device == sdev &&
1293 scsi_eh_action(scmd, SUCCESS) == SUCCESS)
1287 scsi_eh_finish_cmd(scmd, done_q); 1294 scsi_eh_finish_cmd(scmd, done_q);
1288 } 1295 }
1289 } 1296 }
@@ -1350,7 +1357,8 @@ static int scsi_eh_bus_device_reset(struct Scsi_Host *shost,
1350 !scsi_eh_tur(bdr_scmd)) { 1357 !scsi_eh_tur(bdr_scmd)) {
1351 list_for_each_entry_safe(scmd, next, 1358 list_for_each_entry_safe(scmd, next,
1352 work_q, eh_entry) { 1359 work_q, eh_entry) {
1353 if (scmd->device == sdev) 1360 if (scmd->device == sdev &&
1361 scsi_eh_action(scmd, rtn) != FAILED)
1354 scsi_eh_finish_cmd(scmd, 1362 scsi_eh_finish_cmd(scmd,
1355 done_q); 1363 done_q);
1356 } 1364 }