Lines Matching refs:scmd

60 static int scsi_eh_try_stu(struct scsi_cmnd *scmd);
149 struct scsi_cmnd *scmd = in scmd_eh_abort_handler() local
151 struct scsi_device *sdev = scmd->device; in scmd_eh_abort_handler()
158 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
164 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
166 rtn = scsi_try_to_abort_cmd(shost->hostt, scmd); in scmd_eh_abort_handler()
169 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
175 set_host_byte(scmd, DID_TIME_OUT); in scmd_eh_abort_handler()
178 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
185 list_del_init(&scmd->eh_entry); in scmd_eh_abort_handler()
198 if (!scsi_noretry_cmd(scmd) && in scmd_eh_abort_handler()
199 scsi_cmd_retry_allowed(scmd) && in scmd_eh_abort_handler()
200 scsi_eh_should_retry_cmd(scmd)) { in scmd_eh_abort_handler()
202 scmd_printk(KERN_WARNING, scmd, in scmd_eh_abort_handler()
204 scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); in scmd_eh_abort_handler()
207 scmd_printk(KERN_WARNING, scmd, in scmd_eh_abort_handler()
209 scsi_finish_command(scmd); in scmd_eh_abort_handler()
215 list_del_init(&scmd->eh_entry); in scmd_eh_abort_handler()
218 scsi_eh_scmd_add(scmd); in scmd_eh_abort_handler()
228 scsi_abort_command(struct scsi_cmnd *scmd) in scsi_abort_command() argument
230 struct scsi_device *sdev = scmd->device; in scsi_abort_command()
239 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { in scsi_abort_command()
244 scmd_printk(KERN_INFO, scmd, in scsi_abort_command()
246 BUG_ON(delayed_work_pending(&scmd->abort_work)); in scsi_abort_command()
253 BUG_ON(!list_empty(&scmd->eh_entry)); in scsi_abort_command()
254 list_add_tail(&scmd->eh_entry, &shost->eh_abort_list); in scsi_abort_command()
257 scmd->eh_eflags |= SCSI_EH_ABORT_SCHEDULED; in scsi_abort_command()
259 scmd_printk(KERN_INFO, scmd, "abort scheduled\n")); in scsi_abort_command()
260 queue_delayed_work(shost->tmf_work_q, &scmd->abort_work, HZ / 100); in scsi_abort_command()
272 static void scsi_eh_reset(struct scsi_cmnd *scmd) in scsi_eh_reset() argument
274 if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { in scsi_eh_reset()
275 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); in scsi_eh_reset()
277 sdrv->eh_reset(scmd); in scsi_eh_reset()
283 struct scsi_cmnd *scmd = container_of(head, typeof(*scmd), rcu); in scsi_eh_inc_host_failed() local
284 struct Scsi_Host *shost = scmd->device->host; in scsi_eh_inc_host_failed()
297 void scsi_eh_scmd_add(struct scsi_cmnd *scmd) in scsi_eh_scmd_add() argument
299 struct Scsi_Host *shost = scmd->device->host; in scsi_eh_scmd_add()
313 scsi_eh_reset(scmd); in scsi_eh_scmd_add()
314 list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); in scsi_eh_scmd_add()
320 call_rcu_hurry(&scmd->rcu, scsi_eh_inc_host_failed); in scsi_eh_scmd_add()
335 struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req); in scsi_timeout() local
336 struct Scsi_Host *host = scmd->device->host; in scsi_timeout()
338 trace_scsi_dispatch_cmd_timeout(scmd); in scsi_timeout()
339 scsi_log_completion(scmd, TIMEOUT_ERROR); in scsi_timeout()
341 atomic_inc(&scmd->device->iotmo_cnt); in scsi_timeout()
346 switch (host->hostt->eh_timed_out(scmd)) { in scsi_timeout()
360 if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state)) in scsi_timeout()
362 atomic_inc(&scmd->device->iodone_cnt); in scsi_timeout()
363 if (scsi_abort_command(scmd) != SUCCESS) { in scsi_timeout()
364 set_host_byte(scmd, DID_TIME_OUT); in scsi_timeout()
365 scsi_eh_scmd_add(scmd); in scsi_timeout()
403 struct scsi_cmnd *scmd; in scsi_eh_prt_fail_stats() local
411 list_for_each_entry(scmd, work_q, eh_entry) { in scsi_eh_prt_fail_stats()
412 if (scmd->device == sdev) { in scsi_eh_prt_fail_stats()
414 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) in scsi_eh_prt_fail_stats()
537 enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) in scsi_check_sense() argument
539 struct scsi_device *sdev = scmd->device; in scsi_check_sense()
542 if (! scsi_command_normalize_sense(scmd, &sshdr)) in scsi_check_sense()
559 if (scmd->cmnd[0] == TEST_UNIT_READY && in scsi_check_sense()
560 scmd->submitter != SUBMITTED_BY_SCSI_ERROR_HANDLER) in scsi_check_sense()
574 if (scmd->sense_buffer[2] & 0xe0) in scsi_check_sense()
583 (scmd->sense_buffer[8] == 0x4) && in scsi_check_sense()
584 (scmd->sense_buffer[11] & 0xe0)) in scsi_check_sense()
613 if (scmd->device->expecting_cc_ua) { in scsi_check_sense()
621 scmd->device->expecting_cc_ua = 0; in scsi_check_sense()
630 if (scmd->device->sdev_target->expecting_lun_change && in scsi_check_sense()
643 if (scmd->device->allow_restart && in scsi_check_sense()
656 set_scsi_ml_byte(scmd, SCSIML_STAT_NOSPC); in scsi_check_sense()
664 set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); in scsi_check_sense()
671 set_scsi_ml_byte(scmd, SCSIML_STAT_MED_ERROR); in scsi_check_sense()
677 if (scmd->device->retry_hwerror) in scsi_check_sense()
680 set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); in scsi_check_sense()
690 set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); in scsi_check_sense()
763 static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd) in scsi_eh_completed_normally() argument
769 if (host_byte(scmd->result) == DID_RESET) { in scsi_eh_completed_normally()
776 return scsi_check_sense(scmd); in scsi_eh_completed_normally()
778 if (host_byte(scmd->result) != DID_OK) in scsi_eh_completed_normally()
785 switch (get_status_byte(scmd)) { in scsi_eh_completed_normally()
787 scsi_handle_queue_ramp_up(scmd->device); in scsi_eh_completed_normally()
792 return scsi_check_sense(scmd); in scsi_eh_completed_normally()
801 if (scmd->cmnd[0] == TEST_UNIT_READY) in scsi_eh_completed_normally()
808 scsi_handle_queue_full(scmd->device); in scsi_eh_completed_normally()
822 void scsi_eh_done(struct scsi_cmnd *scmd) in scsi_eh_done() argument
826 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_done()
827 "%s result: %x\n", __func__, scmd->result)); in scsi_eh_done()
829 eh_action = scmd->device->host->eh_action; in scsi_eh_done()
838 static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd) in scsi_try_host_reset() argument
842 struct Scsi_Host *host = scmd->device->host; in scsi_try_host_reset()
851 rtn = hostt->eh_host_reset_handler(scmd); in scsi_try_host_reset()
857 scsi_report_bus_reset(host, scmd_channel(scmd)); in scsi_try_host_reset()
868 static enum scsi_disposition scsi_try_bus_reset(struct scsi_cmnd *scmd) in scsi_try_bus_reset() argument
872 struct Scsi_Host *host = scmd->device->host; in scsi_try_bus_reset()
875 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_try_bus_reset()
881 rtn = hostt->eh_bus_reset_handler(scmd); in scsi_try_bus_reset()
887 scsi_report_bus_reset(host, scmd_channel(scmd)); in scsi_try_bus_reset()
910 static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd) in scsi_try_target_reset() argument
914 struct Scsi_Host *host = scmd->device->host; in scsi_try_target_reset()
920 rtn = hostt->eh_target_reset_handler(scmd); in scsi_try_target_reset()
923 __starget_for_each_device(scsi_target(scmd->device), NULL, in scsi_try_target_reset()
941 static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd) in scsi_try_bus_device_reset() argument
944 struct scsi_host_template *hostt = scmd->device->host->hostt; in scsi_try_bus_device_reset()
949 rtn = hostt->eh_device_reset_handler(scmd); in scsi_try_bus_device_reset()
951 __scsi_report_device_reset(scmd->device, NULL); in scsi_try_bus_device_reset()
973 scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct scsi_cmnd *scmd) in scsi_try_to_abort_cmd() argument
978 return hostt->eh_abort_handler(scmd); in scsi_try_to_abort_cmd()
981 static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) in scsi_abort_eh_cmnd() argument
983 if (scsi_try_to_abort_cmd(scmd->device->host->hostt, scmd) != SUCCESS) in scsi_abort_eh_cmnd()
984 if (scsi_try_bus_device_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
985 if (scsi_try_target_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
986 if (scsi_try_bus_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
987 scsi_try_host_reset(scmd); in scsi_abort_eh_cmnd()
1004 void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, in scsi_eh_prep_cmnd() argument
1007 struct scsi_device *sdev = scmd->device; in scsi_eh_prep_cmnd()
1016 ses->cmd_len = scmd->cmd_len; in scsi_eh_prep_cmnd()
1017 ses->data_direction = scmd->sc_data_direction; in scsi_eh_prep_cmnd()
1018 ses->sdb = scmd->sdb; in scsi_eh_prep_cmnd()
1019 ses->result = scmd->result; in scsi_eh_prep_cmnd()
1020 ses->resid_len = scmd->resid_len; in scsi_eh_prep_cmnd()
1021 ses->underflow = scmd->underflow; in scsi_eh_prep_cmnd()
1022 ses->prot_op = scmd->prot_op; in scsi_eh_prep_cmnd()
1023 ses->eh_eflags = scmd->eh_eflags; in scsi_eh_prep_cmnd()
1025 scmd->prot_op = SCSI_PROT_NORMAL; in scsi_eh_prep_cmnd()
1026 scmd->eh_eflags = 0; in scsi_eh_prep_cmnd()
1027 memcpy(ses->cmnd, scmd->cmnd, sizeof(ses->cmnd)); in scsi_eh_prep_cmnd()
1028 memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); in scsi_eh_prep_cmnd()
1029 memset(&scmd->sdb, 0, sizeof(scmd->sdb)); in scsi_eh_prep_cmnd()
1030 scmd->result = 0; in scsi_eh_prep_cmnd()
1031 scmd->resid_len = 0; in scsi_eh_prep_cmnd()
1034 scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, in scsi_eh_prep_cmnd()
1036 sg_init_one(&ses->sense_sgl, scmd->sense_buffer, in scsi_eh_prep_cmnd()
1037 scmd->sdb.length); in scsi_eh_prep_cmnd()
1038 scmd->sdb.table.sgl = &ses->sense_sgl; in scsi_eh_prep_cmnd()
1039 scmd->sc_data_direction = DMA_FROM_DEVICE; in scsi_eh_prep_cmnd()
1040 scmd->sdb.table.nents = scmd->sdb.table.orig_nents = 1; in scsi_eh_prep_cmnd()
1041 scmd->cmnd[0] = REQUEST_SENSE; in scsi_eh_prep_cmnd()
1042 scmd->cmnd[4] = scmd->sdb.length; in scsi_eh_prep_cmnd()
1043 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_prep_cmnd()
1045 scmd->sc_data_direction = DMA_NONE; in scsi_eh_prep_cmnd()
1047 BUG_ON(cmnd_size > sizeof(scmd->cmnd)); in scsi_eh_prep_cmnd()
1048 memcpy(scmd->cmnd, cmnd, cmnd_size); in scsi_eh_prep_cmnd()
1049 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_prep_cmnd()
1053 scmd->underflow = 0; in scsi_eh_prep_cmnd()
1056 scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | in scsi_eh_prep_cmnd()
1063 memset(scmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in scsi_eh_prep_cmnd()
1074 void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) in scsi_eh_restore_cmnd() argument
1079 scmd->cmd_len = ses->cmd_len; in scsi_eh_restore_cmnd()
1080 memcpy(scmd->cmnd, ses->cmnd, sizeof(ses->cmnd)); in scsi_eh_restore_cmnd()
1081 scmd->sc_data_direction = ses->data_direction; in scsi_eh_restore_cmnd()
1082 scmd->sdb = ses->sdb; in scsi_eh_restore_cmnd()
1083 scmd->result = ses->result; in scsi_eh_restore_cmnd()
1084 scmd->resid_len = ses->resid_len; in scsi_eh_restore_cmnd()
1085 scmd->underflow = ses->underflow; in scsi_eh_restore_cmnd()
1086 scmd->prot_op = ses->prot_op; in scsi_eh_restore_cmnd()
1087 scmd->eh_eflags = ses->eh_eflags; in scsi_eh_restore_cmnd()
1105 static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd, in scsi_send_eh_cmnd() argument
1108 struct scsi_device *sdev = scmd->device; in scsi_send_eh_cmnd()
1117 scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); in scsi_send_eh_cmnd()
1120 scsi_log_send(scmd); in scsi_send_eh_cmnd()
1121 scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER; in scsi_send_eh_cmnd()
1140 rtn = shost->hostt->queuecommand(shost, scmd); in scsi_send_eh_cmnd()
1147 scsi_eh_restore_cmnd(scmd, &ses); in scsi_send_eh_cmnd()
1163 scsi_log_completion(scmd, rtn); in scsi_send_eh_cmnd()
1165 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_send_eh_cmnd()
1179 rtn = scsi_eh_completed_normally(scmd); in scsi_send_eh_cmnd()
1180 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_send_eh_cmnd()
1196 scsi_abort_eh_cmnd(scmd); in scsi_send_eh_cmnd()
1200 scsi_eh_restore_cmnd(scmd, &ses); in scsi_send_eh_cmnd()
1214 static enum scsi_disposition scsi_request_sense(struct scsi_cmnd *scmd) in scsi_request_sense() argument
1216 return scsi_send_eh_cmnd(scmd, NULL, 0, scmd->device->eh_timeout, ~0); in scsi_request_sense()
1220 scsi_eh_action(struct scsi_cmnd *scmd, enum scsi_disposition rtn) in scsi_eh_action() argument
1222 if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { in scsi_eh_action()
1223 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); in scsi_eh_action()
1225 rtn = sdrv->eh_action(scmd, rtn); in scsi_eh_action()
1242 void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) in scsi_eh_finish_cmd() argument
1244 list_move_tail(&scmd->eh_entry, done_q); in scsi_eh_finish_cmd()
1271 struct scsi_cmnd *scmd, *next; in scsi_eh_get_sense() local
1279 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_get_sense()
1280 if ((scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) || in scsi_eh_get_sense()
1281 SCSI_SENSE_VALID(scmd)) in scsi_eh_get_sense()
1284 shost = scmd->device->host; in scsi_eh_get_sense()
1287 scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1292 if (!scsi_status_is_check_condition(scmd->result)) in scsi_eh_get_sense()
1301 SCSI_LOG_ERROR_RECOVERY(2, scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1304 rtn = scsi_request_sense(scmd); in scsi_eh_get_sense()
1308 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1309 "sense requested, result %x\n", scmd->result)); in scsi_eh_get_sense()
1310 SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense(scmd)); in scsi_eh_get_sense()
1312 rtn = scsi_decide_disposition(scmd); in scsi_eh_get_sense()
1327 if (scmd->allowed == SCSI_CMD_RETRIES_NO_LIMIT) in scsi_eh_get_sense()
1328 scmd->retries = scmd->allowed = 1; in scsi_eh_get_sense()
1330 scmd->retries = scmd->allowed; in scsi_eh_get_sense()
1334 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_get_sense()
1348 static int scsi_eh_tur(struct scsi_cmnd *scmd) in scsi_eh_tur() argument
1355 rtn = scsi_send_eh_cmnd(scmd, tur_command, 6, in scsi_eh_tur()
1356 scmd->device->eh_timeout, 0); in scsi_eh_tur()
1358 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_tur()
1390 struct scsi_cmnd *scmd, *next; in scsi_eh_test_devices() local
1395 scmd = list_entry(cmd_list->next, struct scsi_cmnd, eh_entry); in scsi_eh_test_devices()
1396 sdev = scmd->device; in scsi_eh_test_devices()
1410 finish_cmds = !scsi_device_online(scmd->device) || in scsi_eh_test_devices()
1411 (try_stu && !scsi_eh_try_stu(scmd) && in scsi_eh_test_devices()
1412 !scsi_eh_tur(scmd)) || in scsi_eh_test_devices()
1413 !scsi_eh_tur(scmd); in scsi_eh_test_devices()
1415 list_for_each_entry_safe(scmd, next, cmd_list, eh_entry) in scsi_eh_test_devices()
1416 if (scmd->device == sdev) { in scsi_eh_test_devices()
1419 scsi_eh_action(scmd, SUCCESS) == SUCCESS)) in scsi_eh_test_devices()
1420 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_test_devices()
1422 list_move_tail(&scmd->eh_entry, work_q); in scsi_eh_test_devices()
1435 static int scsi_eh_try_stu(struct scsi_cmnd *scmd) in scsi_eh_try_stu() argument
1439 if (scmd->device->allow_restart) { in scsi_eh_try_stu()
1444 rtn = scsi_send_eh_cmnd(scmd, stu_command, 6, in scsi_eh_try_stu()
1445 scmd->device->eh_timeout, 0); in scsi_eh_try_stu()
1468 struct scsi_cmnd *scmd, *stu_scmd, *next; in scsi_eh_stu() local
1481 list_for_each_entry(scmd, work_q, eh_entry) in scsi_eh_stu()
1482 if (scmd->device == sdev && SCSI_SENSE_VALID(scmd) && in scsi_eh_stu()
1483 scsi_check_sense(scmd) == FAILED ) { in scsi_eh_stu()
1484 stu_scmd = scmd; in scsi_eh_stu()
1499 list_for_each_entry_safe(scmd, next, in scsi_eh_stu()
1501 if (scmd->device == sdev && in scsi_eh_stu()
1502 scsi_eh_action(scmd, SUCCESS) == SUCCESS) in scsi_eh_stu()
1503 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_stu()
1534 struct scsi_cmnd *scmd, *bdr_scmd, *next; in scsi_eh_bus_device_reset() local
1548 list_for_each_entry(scmd, work_q, eh_entry) in scsi_eh_bus_device_reset()
1549 if (scmd->device == sdev) { in scsi_eh_bus_device_reset()
1550 bdr_scmd = scmd; in scsi_eh_bus_device_reset()
1565 list_for_each_entry_safe(scmd, next, in scsi_eh_bus_device_reset()
1567 if (scmd->device == sdev && in scsi_eh_bus_device_reset()
1568 scsi_eh_action(scmd, rtn) != FAILED) in scsi_eh_bus_device_reset()
1569 scsi_eh_finish_cmd(scmd, in scsi_eh_bus_device_reset()
1602 struct scsi_cmnd *next, *scmd; in scsi_eh_target_reset() local
1617 scmd = list_entry(tmp_list.next, struct scsi_cmnd, eh_entry); in scsi_eh_target_reset()
1618 id = scmd_id(scmd); in scsi_eh_target_reset()
1624 rtn = scsi_try_target_reset(scmd); in scsi_eh_target_reset()
1631 list_for_each_entry_safe(scmd, next, &tmp_list, eh_entry) { in scsi_eh_target_reset()
1632 if (scmd_id(scmd) != id) in scsi_eh_target_reset()
1636 list_move_tail(&scmd->eh_entry, &check_list); in scsi_eh_target_reset()
1638 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_target_reset()
1641 list_move(&scmd->eh_entry, work_q); in scsi_eh_target_reset()
1658 struct scsi_cmnd *scmd, *chan_scmd, *next; in scsi_eh_bus_reset() local
1681 list_for_each_entry(scmd, work_q, eh_entry) { in scsi_eh_bus_reset()
1682 if (channel == scmd_channel(scmd)) { in scsi_eh_bus_reset()
1683 chan_scmd = scmd; in scsi_eh_bus_reset()
1700 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_bus_reset()
1701 if (channel == scmd_channel(scmd)) { in scsi_eh_bus_reset()
1703 scsi_eh_finish_cmd(scmd, in scsi_eh_bus_reset()
1706 list_move_tail(&scmd->eh_entry, in scsi_eh_bus_reset()
1730 struct scsi_cmnd *scmd, *next; in scsi_eh_host_reset() local
1735 scmd = list_entry(work_q->next, in scsi_eh_host_reset()
1743 rtn = scsi_try_host_reset(scmd); in scsi_eh_host_reset()
1747 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_host_reset()
1748 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_host_reset()
1768 struct scsi_cmnd *scmd, *next; in scsi_eh_offline_sdevs() local
1771 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_offline_sdevs()
1772 sdev_printk(KERN_INFO, scmd->device, "Device offlined - " in scsi_eh_offline_sdevs()
1774 sdev = scmd->device; in scsi_eh_offline_sdevs()
1780 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_offline_sdevs()
1789 bool scsi_noretry_cmd(struct scsi_cmnd *scmd) in scsi_noretry_cmd() argument
1791 struct request *req = scsi_cmd_to_rq(scmd); in scsi_noretry_cmd()
1793 switch (host_byte(scmd->result)) { in scsi_noretry_cmd()
1803 if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) in scsi_noretry_cmd()
1810 if (!scsi_status_is_check_condition(scmd->result)) in scsi_noretry_cmd()
1838 enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) in scsi_decide_disposition() argument
1846 if (!scsi_device_online(scmd->device)) { in scsi_decide_disposition()
1847 SCSI_LOG_ERROR_RECOVERY(5, scmd_printk(KERN_INFO, scmd, in scsi_decide_disposition()
1856 switch (host_byte(scmd->result)) { in scsi_decide_disposition()
1863 scmd->result &= 0xff00ffff; in scsi_decide_disposition()
1871 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { in scsi_decide_disposition()
1872 set_host_byte(scmd, DID_TIME_OUT); in scsi_decide_disposition()
1918 if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) in scsi_decide_disposition()
1934 if ((scmd->cmnd[0] == TEST_UNIT_READY || in scsi_decide_disposition()
1935 scmd->cmnd[0] == INQUIRY)) { in scsi_decide_disposition()
1949 switch (get_status_byte(scmd)) { in scsi_decide_disposition()
1951 scsi_handle_queue_full(scmd->device); in scsi_decide_disposition()
1966 if (scmd->cmnd[0] == REPORT_LUNS) in scsi_decide_disposition()
1967 scmd->device->sdev_target->expecting_lun_change = 0; in scsi_decide_disposition()
1968 scsi_handle_queue_ramp_up(scmd->device); in scsi_decide_disposition()
1975 rtn = scsi_check_sense(scmd); in scsi_decide_disposition()
1993 sdev_printk(KERN_INFO, scmd->device, in scsi_decide_disposition()
1995 set_scsi_ml_byte(scmd, SCSIML_STAT_RESV_CONFLICT); in scsi_decide_disposition()
2006 if (scsi_cmd_retry_allowed(scmd) && !scsi_noretry_cmd(scmd)) { in scsi_decide_disposition()
2036 struct scsi_cmnd *scmd; in scsi_eh_lock_door() local
2042 scmd = blk_mq_rq_to_pdu(req); in scsi_eh_lock_door()
2044 scmd->cmnd[0] = ALLOW_MEDIUM_REMOVAL; in scsi_eh_lock_door()
2045 scmd->cmnd[1] = 0; in scsi_eh_lock_door()
2046 scmd->cmnd[2] = 0; in scsi_eh_lock_door()
2047 scmd->cmnd[3] = 0; in scsi_eh_lock_door()
2048 scmd->cmnd[4] = SCSI_REMOVAL_PREVENT; in scsi_eh_lock_door()
2049 scmd->cmnd[5] = 0; in scsi_eh_lock_door()
2050 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_lock_door()
2051 scmd->allowed = 5; in scsi_eh_lock_door()
2150 struct scsi_cmnd *scmd, *next; in scsi_eh_flush_done_q() local
2152 list_for_each_entry_safe(scmd, next, done_q, eh_entry) { in scsi_eh_flush_done_q()
2153 list_del_init(&scmd->eh_entry); in scsi_eh_flush_done_q()
2154 if (scsi_device_online(scmd->device) && in scsi_eh_flush_done_q()
2155 !scsi_noretry_cmd(scmd) && scsi_cmd_retry_allowed(scmd) && in scsi_eh_flush_done_q()
2156 scsi_eh_should_retry_cmd(scmd)) { in scsi_eh_flush_done_q()
2158 scmd_printk(KERN_INFO, scmd, in scsi_eh_flush_done_q()
2161 scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); in scsi_eh_flush_done_q()
2168 if (!scmd->result) in scsi_eh_flush_done_q()
2169 scmd->result |= (DID_TIME_OUT << 16); in scsi_eh_flush_done_q()
2171 scmd_printk(KERN_INFO, scmd, in scsi_eh_flush_done_q()
2174 scsi_finish_command(scmd); in scsi_eh_flush_done_q()
2388 struct scsi_cmnd *scmd; in scsi_ioctl_reset() local
2412 scmd = (struct scsi_cmnd *)(rq + 1); in scsi_ioctl_reset()
2413 scsi_init_command(dev, scmd); in scsi_ioctl_reset()
2415 scmd->submitter = SUBMITTED_BY_SCSI_RESET_IOCTL; in scsi_ioctl_reset()
2416 memset(&scmd->sdb, 0, sizeof(scmd->sdb)); in scsi_ioctl_reset()
2418 scmd->cmd_len = 0; in scsi_ioctl_reset()
2420 scmd->sc_data_direction = DMA_BIDIRECTIONAL; in scsi_ioctl_reset()
2431 rtn = scsi_try_bus_device_reset(scmd); in scsi_ioctl_reset()
2436 rtn = scsi_try_target_reset(scmd); in scsi_ioctl_reset()
2441 rtn = scsi_try_bus_reset(scmd); in scsi_ioctl_reset()
2446 rtn = scsi_try_host_reset(scmd); in scsi_ioctl_reset()