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()
234 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { in scsi_abort_command()
239 scmd_printk(KERN_INFO, scmd, in scsi_abort_command()
241 BUG_ON(delayed_work_pending(&scmd->abort_work)); in scsi_abort_command()
248 BUG_ON(!list_empty(&scmd->eh_entry)); in scsi_abort_command()
249 list_add_tail(&scmd->eh_entry, &shost->eh_abort_list); in scsi_abort_command()
252 scmd->eh_eflags |= SCSI_EH_ABORT_SCHEDULED; in scsi_abort_command()
254 scmd_printk(KERN_INFO, scmd, "abort scheduled\n")); in scsi_abort_command()
255 queue_delayed_work(shost->tmf_work_q, &scmd->abort_work, HZ / 100); in scsi_abort_command()
267 static void scsi_eh_reset(struct scsi_cmnd *scmd) in scsi_eh_reset() argument
269 if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { in scsi_eh_reset()
270 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); in scsi_eh_reset()
272 sdrv->eh_reset(scmd); in scsi_eh_reset()
278 struct scsi_cmnd *scmd = container_of(head, typeof(*scmd), rcu); in scsi_eh_inc_host_failed() local
279 struct Scsi_Host *shost = scmd->device->host; in scsi_eh_inc_host_failed()
292 void scsi_eh_scmd_add(struct scsi_cmnd *scmd) in scsi_eh_scmd_add() argument
294 struct Scsi_Host *shost = scmd->device->host; in scsi_eh_scmd_add()
308 scsi_eh_reset(scmd); in scsi_eh_scmd_add()
309 list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); in scsi_eh_scmd_add()
315 call_rcu(&scmd->rcu, scsi_eh_inc_host_failed); in scsi_eh_scmd_add()
330 struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req); in scsi_timeout() local
332 struct Scsi_Host *host = scmd->device->host; in scsi_timeout()
334 trace_scsi_dispatch_cmd_timeout(scmd); in scsi_timeout()
335 scsi_log_completion(scmd, TIMEOUT_ERROR); in scsi_timeout()
337 atomic_inc(&scmd->device->iotmo_cnt); in scsi_timeout()
342 rtn = host->hostt->eh_timed_out(scmd); in scsi_timeout()
357 if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state)) in scsi_timeout()
359 if (scsi_abort_command(scmd) != SUCCESS) { in scsi_timeout()
360 set_host_byte(scmd, DID_TIME_OUT); in scsi_timeout()
361 scsi_eh_scmd_add(scmd); in scsi_timeout()
400 struct scsi_cmnd *scmd; in scsi_eh_prt_fail_stats() local
408 list_for_each_entry(scmd, work_q, eh_entry) { in scsi_eh_prt_fail_stats()
409 if (scmd->device == sdev) { in scsi_eh_prt_fail_stats()
411 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) in scsi_eh_prt_fail_stats()
534 enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) in scsi_check_sense() argument
536 struct scsi_device *sdev = scmd->device; in scsi_check_sense()
539 if (! scsi_command_normalize_sense(scmd, &sshdr)) in scsi_check_sense()
556 if (scmd->cmnd[0] == TEST_UNIT_READY && in scsi_check_sense()
557 scmd->submitter != SUBMITTED_BY_SCSI_ERROR_HANDLER) in scsi_check_sense()
571 if (scmd->sense_buffer[2] & 0xe0) in scsi_check_sense()
580 (scmd->sense_buffer[8] == 0x4) && in scsi_check_sense()
581 (scmd->sense_buffer[11] & 0xe0)) in scsi_check_sense()
610 if (scmd->device->expecting_cc_ua) { in scsi_check_sense()
618 scmd->device->expecting_cc_ua = 0; in scsi_check_sense()
627 if (scmd->device->sdev_target->expecting_lun_change && in scsi_check_sense()
640 if (scmd->device->allow_restart && in scsi_check_sense()
653 set_scsi_ml_byte(scmd, SCSIML_STAT_NOSPC); in scsi_check_sense()
661 set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); in scsi_check_sense()
668 set_scsi_ml_byte(scmd, SCSIML_STAT_MED_ERROR); in scsi_check_sense()
674 if (scmd->device->retry_hwerror) in scsi_check_sense()
677 set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); in scsi_check_sense()
687 set_scsi_ml_byte(scmd, SCSIML_STAT_TGT_FAILURE); in scsi_check_sense()
760 static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd) in scsi_eh_completed_normally() argument
766 if (host_byte(scmd->result) == DID_RESET) { in scsi_eh_completed_normally()
773 return scsi_check_sense(scmd); in scsi_eh_completed_normally()
775 if (host_byte(scmd->result) != DID_OK) in scsi_eh_completed_normally()
782 switch (get_status_byte(scmd)) { in scsi_eh_completed_normally()
784 scsi_handle_queue_ramp_up(scmd->device); in scsi_eh_completed_normally()
789 return scsi_check_sense(scmd); in scsi_eh_completed_normally()
798 if (scmd->cmnd[0] == TEST_UNIT_READY) in scsi_eh_completed_normally()
805 scsi_handle_queue_full(scmd->device); in scsi_eh_completed_normally()
819 void scsi_eh_done(struct scsi_cmnd *scmd) in scsi_eh_done() argument
823 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_done()
824 "%s result: %x\n", __func__, scmd->result)); in scsi_eh_done()
826 eh_action = scmd->device->host->eh_action; in scsi_eh_done()
835 static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd) in scsi_try_host_reset() argument
839 struct Scsi_Host *host = scmd->device->host; in scsi_try_host_reset()
848 rtn = hostt->eh_host_reset_handler(scmd); in scsi_try_host_reset()
854 scsi_report_bus_reset(host, scmd_channel(scmd)); in scsi_try_host_reset()
865 static enum scsi_disposition scsi_try_bus_reset(struct scsi_cmnd *scmd) in scsi_try_bus_reset() argument
869 struct Scsi_Host *host = scmd->device->host; in scsi_try_bus_reset()
872 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_try_bus_reset()
878 rtn = hostt->eh_bus_reset_handler(scmd); in scsi_try_bus_reset()
884 scsi_report_bus_reset(host, scmd_channel(scmd)); in scsi_try_bus_reset()
907 static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd) in scsi_try_target_reset() argument
911 struct Scsi_Host *host = scmd->device->host; in scsi_try_target_reset()
917 rtn = hostt->eh_target_reset_handler(scmd); in scsi_try_target_reset()
920 __starget_for_each_device(scsi_target(scmd->device), NULL, in scsi_try_target_reset()
938 static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd) in scsi_try_bus_device_reset() argument
941 struct scsi_host_template *hostt = scmd->device->host->hostt; in scsi_try_bus_device_reset()
946 rtn = hostt->eh_device_reset_handler(scmd); in scsi_try_bus_device_reset()
948 __scsi_report_device_reset(scmd->device, NULL); in scsi_try_bus_device_reset()
970 scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct scsi_cmnd *scmd) in scsi_try_to_abort_cmd() argument
975 return hostt->eh_abort_handler(scmd); in scsi_try_to_abort_cmd()
978 static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) in scsi_abort_eh_cmnd() argument
980 if (scsi_try_to_abort_cmd(scmd->device->host->hostt, scmd) != SUCCESS) in scsi_abort_eh_cmnd()
981 if (scsi_try_bus_device_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
982 if (scsi_try_target_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
983 if (scsi_try_bus_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
984 scsi_try_host_reset(scmd); in scsi_abort_eh_cmnd()
1001 void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, in scsi_eh_prep_cmnd() argument
1004 struct scsi_device *sdev = scmd->device; in scsi_eh_prep_cmnd()
1013 ses->cmd_len = scmd->cmd_len; in scsi_eh_prep_cmnd()
1014 ses->data_direction = scmd->sc_data_direction; in scsi_eh_prep_cmnd()
1015 ses->sdb = scmd->sdb; in scsi_eh_prep_cmnd()
1016 ses->result = scmd->result; in scsi_eh_prep_cmnd()
1017 ses->resid_len = scmd->resid_len; in scsi_eh_prep_cmnd()
1018 ses->underflow = scmd->underflow; in scsi_eh_prep_cmnd()
1019 ses->prot_op = scmd->prot_op; in scsi_eh_prep_cmnd()
1020 ses->eh_eflags = scmd->eh_eflags; in scsi_eh_prep_cmnd()
1022 scmd->prot_op = SCSI_PROT_NORMAL; in scsi_eh_prep_cmnd()
1023 scmd->eh_eflags = 0; in scsi_eh_prep_cmnd()
1024 memcpy(ses->cmnd, scmd->cmnd, sizeof(ses->cmnd)); in scsi_eh_prep_cmnd()
1025 memset(scmd->cmnd, 0, sizeof(scmd->cmnd)); in scsi_eh_prep_cmnd()
1026 memset(&scmd->sdb, 0, sizeof(scmd->sdb)); in scsi_eh_prep_cmnd()
1027 scmd->result = 0; in scsi_eh_prep_cmnd()
1028 scmd->resid_len = 0; in scsi_eh_prep_cmnd()
1031 scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, in scsi_eh_prep_cmnd()
1033 sg_init_one(&ses->sense_sgl, scmd->sense_buffer, in scsi_eh_prep_cmnd()
1034 scmd->sdb.length); in scsi_eh_prep_cmnd()
1035 scmd->sdb.table.sgl = &ses->sense_sgl; in scsi_eh_prep_cmnd()
1036 scmd->sc_data_direction = DMA_FROM_DEVICE; in scsi_eh_prep_cmnd()
1037 scmd->sdb.table.nents = scmd->sdb.table.orig_nents = 1; in scsi_eh_prep_cmnd()
1038 scmd->cmnd[0] = REQUEST_SENSE; in scsi_eh_prep_cmnd()
1039 scmd->cmnd[4] = scmd->sdb.length; in scsi_eh_prep_cmnd()
1040 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_prep_cmnd()
1042 scmd->sc_data_direction = DMA_NONE; in scsi_eh_prep_cmnd()
1044 BUG_ON(cmnd_size > sizeof(scmd->cmnd)); in scsi_eh_prep_cmnd()
1045 memcpy(scmd->cmnd, cmnd, cmnd_size); in scsi_eh_prep_cmnd()
1046 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_prep_cmnd()
1050 scmd->underflow = 0; in scsi_eh_prep_cmnd()
1053 scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | in scsi_eh_prep_cmnd()
1060 memset(scmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in scsi_eh_prep_cmnd()
1071 void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) in scsi_eh_restore_cmnd() argument
1076 scmd->cmd_len = ses->cmd_len; in scsi_eh_restore_cmnd()
1077 memcpy(scmd->cmnd, ses->cmnd, sizeof(ses->cmnd)); in scsi_eh_restore_cmnd()
1078 scmd->sc_data_direction = ses->data_direction; in scsi_eh_restore_cmnd()
1079 scmd->sdb = ses->sdb; in scsi_eh_restore_cmnd()
1080 scmd->result = ses->result; in scsi_eh_restore_cmnd()
1081 scmd->resid_len = ses->resid_len; in scsi_eh_restore_cmnd()
1082 scmd->underflow = ses->underflow; in scsi_eh_restore_cmnd()
1083 scmd->prot_op = ses->prot_op; in scsi_eh_restore_cmnd()
1084 scmd->eh_eflags = ses->eh_eflags; in scsi_eh_restore_cmnd()
1102 static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd, in scsi_send_eh_cmnd() argument
1105 struct scsi_device *sdev = scmd->device; in scsi_send_eh_cmnd()
1114 scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); in scsi_send_eh_cmnd()
1117 scsi_log_send(scmd); in scsi_send_eh_cmnd()
1118 scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER; in scsi_send_eh_cmnd()
1137 rtn = shost->hostt->queuecommand(shost, scmd); in scsi_send_eh_cmnd()
1144 scsi_eh_restore_cmnd(scmd, &ses); in scsi_send_eh_cmnd()
1160 scsi_log_completion(scmd, rtn); in scsi_send_eh_cmnd()
1162 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_send_eh_cmnd()
1176 rtn = scsi_eh_completed_normally(scmd); in scsi_send_eh_cmnd()
1177 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_send_eh_cmnd()
1193 scsi_abort_eh_cmnd(scmd); in scsi_send_eh_cmnd()
1197 scsi_eh_restore_cmnd(scmd, &ses); in scsi_send_eh_cmnd()
1211 static enum scsi_disposition scsi_request_sense(struct scsi_cmnd *scmd) in scsi_request_sense() argument
1213 return scsi_send_eh_cmnd(scmd, NULL, 0, scmd->device->eh_timeout, ~0); in scsi_request_sense()
1217 scsi_eh_action(struct scsi_cmnd *scmd, enum scsi_disposition rtn) in scsi_eh_action() argument
1219 if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { in scsi_eh_action()
1220 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); in scsi_eh_action()
1222 rtn = sdrv->eh_action(scmd, rtn); in scsi_eh_action()
1239 void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) in scsi_eh_finish_cmd() argument
1241 list_move_tail(&scmd->eh_entry, done_q); in scsi_eh_finish_cmd()
1268 struct scsi_cmnd *scmd, *next; in scsi_eh_get_sense() local
1276 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_get_sense()
1277 if ((scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) || in scsi_eh_get_sense()
1278 SCSI_SENSE_VALID(scmd)) in scsi_eh_get_sense()
1281 shost = scmd->device->host; in scsi_eh_get_sense()
1284 scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1289 if (!scsi_status_is_check_condition(scmd->result)) in scsi_eh_get_sense()
1298 SCSI_LOG_ERROR_RECOVERY(2, scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1301 rtn = scsi_request_sense(scmd); in scsi_eh_get_sense()
1305 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1306 "sense requested, result %x\n", scmd->result)); in scsi_eh_get_sense()
1307 SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense(scmd)); in scsi_eh_get_sense()
1309 rtn = scsi_decide_disposition(scmd); in scsi_eh_get_sense()
1324 if (scmd->allowed == SCSI_CMD_RETRIES_NO_LIMIT) in scsi_eh_get_sense()
1325 scmd->retries = scmd->allowed = 1; in scsi_eh_get_sense()
1327 scmd->retries = scmd->allowed; in scsi_eh_get_sense()
1331 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_get_sense()
1345 static int scsi_eh_tur(struct scsi_cmnd *scmd) in scsi_eh_tur() argument
1352 rtn = scsi_send_eh_cmnd(scmd, tur_command, 6, in scsi_eh_tur()
1353 scmd->device->eh_timeout, 0); in scsi_eh_tur()
1355 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_tur()
1387 struct scsi_cmnd *scmd, *next; in scsi_eh_test_devices() local
1392 scmd = list_entry(cmd_list->next, struct scsi_cmnd, eh_entry); in scsi_eh_test_devices()
1393 sdev = scmd->device; in scsi_eh_test_devices()
1407 finish_cmds = !scsi_device_online(scmd->device) || in scsi_eh_test_devices()
1408 (try_stu && !scsi_eh_try_stu(scmd) && in scsi_eh_test_devices()
1409 !scsi_eh_tur(scmd)) || in scsi_eh_test_devices()
1410 !scsi_eh_tur(scmd); in scsi_eh_test_devices()
1412 list_for_each_entry_safe(scmd, next, cmd_list, eh_entry) in scsi_eh_test_devices()
1413 if (scmd->device == sdev) { in scsi_eh_test_devices()
1416 scsi_eh_action(scmd, SUCCESS) == SUCCESS)) in scsi_eh_test_devices()
1417 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_test_devices()
1419 list_move_tail(&scmd->eh_entry, work_q); in scsi_eh_test_devices()
1432 static int scsi_eh_try_stu(struct scsi_cmnd *scmd) in scsi_eh_try_stu() argument
1436 if (scmd->device->allow_restart) { in scsi_eh_try_stu()
1441 rtn = scsi_send_eh_cmnd(scmd, stu_command, 6, in scsi_eh_try_stu()
1442 scmd->device->eh_timeout, 0); in scsi_eh_try_stu()
1465 struct scsi_cmnd *scmd, *stu_scmd, *next; in scsi_eh_stu() local
1478 list_for_each_entry(scmd, work_q, eh_entry) in scsi_eh_stu()
1479 if (scmd->device == sdev && SCSI_SENSE_VALID(scmd) && in scsi_eh_stu()
1480 scsi_check_sense(scmd) == FAILED ) { in scsi_eh_stu()
1481 stu_scmd = scmd; in scsi_eh_stu()
1496 list_for_each_entry_safe(scmd, next, in scsi_eh_stu()
1498 if (scmd->device == sdev && in scsi_eh_stu()
1499 scsi_eh_action(scmd, SUCCESS) == SUCCESS) in scsi_eh_stu()
1500 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_stu()
1531 struct scsi_cmnd *scmd, *bdr_scmd, *next; in scsi_eh_bus_device_reset() local
1545 list_for_each_entry(scmd, work_q, eh_entry) in scsi_eh_bus_device_reset()
1546 if (scmd->device == sdev) { in scsi_eh_bus_device_reset()
1547 bdr_scmd = scmd; in scsi_eh_bus_device_reset()
1562 list_for_each_entry_safe(scmd, next, in scsi_eh_bus_device_reset()
1564 if (scmd->device == sdev && in scsi_eh_bus_device_reset()
1565 scsi_eh_action(scmd, rtn) != FAILED) in scsi_eh_bus_device_reset()
1566 scsi_eh_finish_cmd(scmd, in scsi_eh_bus_device_reset()
1599 struct scsi_cmnd *next, *scmd; in scsi_eh_target_reset() local
1614 scmd = list_entry(tmp_list.next, struct scsi_cmnd, eh_entry); in scsi_eh_target_reset()
1615 id = scmd_id(scmd); in scsi_eh_target_reset()
1621 rtn = scsi_try_target_reset(scmd); in scsi_eh_target_reset()
1628 list_for_each_entry_safe(scmd, next, &tmp_list, eh_entry) { in scsi_eh_target_reset()
1629 if (scmd_id(scmd) != id) in scsi_eh_target_reset()
1633 list_move_tail(&scmd->eh_entry, &check_list); in scsi_eh_target_reset()
1635 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_target_reset()
1638 list_move(&scmd->eh_entry, work_q); in scsi_eh_target_reset()
1655 struct scsi_cmnd *scmd, *chan_scmd, *next; in scsi_eh_bus_reset() local
1678 list_for_each_entry(scmd, work_q, eh_entry) { in scsi_eh_bus_reset()
1679 if (channel == scmd_channel(scmd)) { in scsi_eh_bus_reset()
1680 chan_scmd = scmd; in scsi_eh_bus_reset()
1697 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_bus_reset()
1698 if (channel == scmd_channel(scmd)) { in scsi_eh_bus_reset()
1700 scsi_eh_finish_cmd(scmd, in scsi_eh_bus_reset()
1703 list_move_tail(&scmd->eh_entry, in scsi_eh_bus_reset()
1727 struct scsi_cmnd *scmd, *next; in scsi_eh_host_reset() local
1732 scmd = list_entry(work_q->next, in scsi_eh_host_reset()
1740 rtn = scsi_try_host_reset(scmd); in scsi_eh_host_reset()
1744 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_host_reset()
1745 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_host_reset()
1765 struct scsi_cmnd *scmd, *next; in scsi_eh_offline_sdevs() local
1768 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_offline_sdevs()
1769 sdev_printk(KERN_INFO, scmd->device, "Device offlined - " in scsi_eh_offline_sdevs()
1771 sdev = scmd->device; in scsi_eh_offline_sdevs()
1777 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_offline_sdevs()
1786 bool scsi_noretry_cmd(struct scsi_cmnd *scmd) in scsi_noretry_cmd() argument
1788 struct request *req = scsi_cmd_to_rq(scmd); in scsi_noretry_cmd()
1790 switch (host_byte(scmd->result)) { in scsi_noretry_cmd()
1800 if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) in scsi_noretry_cmd()
1807 if (!scsi_status_is_check_condition(scmd->result)) in scsi_noretry_cmd()
1835 enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) in scsi_decide_disposition() argument
1843 if (!scsi_device_online(scmd->device)) { in scsi_decide_disposition()
1844 SCSI_LOG_ERROR_RECOVERY(5, scmd_printk(KERN_INFO, scmd, in scsi_decide_disposition()
1853 switch (host_byte(scmd->result)) { in scsi_decide_disposition()
1860 scmd->result &= 0xff00ffff; in scsi_decide_disposition()
1868 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { in scsi_decide_disposition()
1869 set_host_byte(scmd, DID_TIME_OUT); in scsi_decide_disposition()
1915 if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) in scsi_decide_disposition()
1931 if ((scmd->cmnd[0] == TEST_UNIT_READY || in scsi_decide_disposition()
1932 scmd->cmnd[0] == INQUIRY)) { in scsi_decide_disposition()
1946 switch (get_status_byte(scmd)) { in scsi_decide_disposition()
1948 scsi_handle_queue_full(scmd->device); in scsi_decide_disposition()
1963 if (scmd->cmnd[0] == REPORT_LUNS) in scsi_decide_disposition()
1964 scmd->device->sdev_target->expecting_lun_change = 0; in scsi_decide_disposition()
1965 scsi_handle_queue_ramp_up(scmd->device); in scsi_decide_disposition()
1972 rtn = scsi_check_sense(scmd); in scsi_decide_disposition()
1990 sdev_printk(KERN_INFO, scmd->device, in scsi_decide_disposition()
1992 set_scsi_ml_byte(scmd, SCSIML_STAT_RESV_CONFLICT); in scsi_decide_disposition()
2003 if (scsi_cmd_retry_allowed(scmd) && !scsi_noretry_cmd(scmd)) { in scsi_decide_disposition()
2033 struct scsi_cmnd *scmd; in scsi_eh_lock_door() local
2039 scmd = blk_mq_rq_to_pdu(req); in scsi_eh_lock_door()
2041 scmd->cmnd[0] = ALLOW_MEDIUM_REMOVAL; in scsi_eh_lock_door()
2042 scmd->cmnd[1] = 0; in scsi_eh_lock_door()
2043 scmd->cmnd[2] = 0; in scsi_eh_lock_door()
2044 scmd->cmnd[3] = 0; in scsi_eh_lock_door()
2045 scmd->cmnd[4] = SCSI_REMOVAL_PREVENT; in scsi_eh_lock_door()
2046 scmd->cmnd[5] = 0; in scsi_eh_lock_door()
2047 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_lock_door()
2048 scmd->allowed = 5; in scsi_eh_lock_door()
2147 struct scsi_cmnd *scmd, *next; in scsi_eh_flush_done_q() local
2149 list_for_each_entry_safe(scmd, next, done_q, eh_entry) { in scsi_eh_flush_done_q()
2150 list_del_init(&scmd->eh_entry); in scsi_eh_flush_done_q()
2151 if (scsi_device_online(scmd->device) && in scsi_eh_flush_done_q()
2152 !scsi_noretry_cmd(scmd) && scsi_cmd_retry_allowed(scmd) && in scsi_eh_flush_done_q()
2153 scsi_eh_should_retry_cmd(scmd)) { in scsi_eh_flush_done_q()
2155 scmd_printk(KERN_INFO, scmd, in scsi_eh_flush_done_q()
2158 scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); in scsi_eh_flush_done_q()
2165 if (!scmd->result) in scsi_eh_flush_done_q()
2166 scmd->result |= (DID_TIME_OUT << 16); in scsi_eh_flush_done_q()
2168 scmd_printk(KERN_INFO, scmd, in scsi_eh_flush_done_q()
2171 scsi_finish_command(scmd); in scsi_eh_flush_done_q()
2385 struct scsi_cmnd *scmd; in scsi_ioctl_reset() local
2409 scmd = (struct scsi_cmnd *)(rq + 1); in scsi_ioctl_reset()
2410 scsi_init_command(dev, scmd); in scsi_ioctl_reset()
2412 scmd->submitter = SUBMITTED_BY_SCSI_RESET_IOCTL; in scsi_ioctl_reset()
2413 memset(&scmd->sdb, 0, sizeof(scmd->sdb)); in scsi_ioctl_reset()
2415 scmd->cmd_len = 0; in scsi_ioctl_reset()
2417 scmd->sc_data_direction = DMA_BIDIRECTIONAL; in scsi_ioctl_reset()
2428 rtn = scsi_try_bus_device_reset(scmd); in scsi_ioctl_reset()
2433 rtn = scsi_try_target_reset(scmd); in scsi_ioctl_reset()
2438 rtn = scsi_try_bus_reset(scmd); in scsi_ioctl_reset()
2443 rtn = scsi_try_host_reset(scmd); in scsi_ioctl_reset()