Lines Matching refs:scmd

60 static int scsi_eh_try_stu(struct scsi_cmnd *scmd);
136 static void scsi_eh_complete_abort(struct scsi_cmnd *scmd, struct Scsi_Host *shost) in scsi_eh_complete_abort() argument
141 list_del_init(&scmd->eh_entry); in scsi_eh_complete_abort()
166 struct scsi_cmnd *scmd = in scmd_eh_abort_handler() local
168 struct scsi_device *sdev = scmd->device; in scmd_eh_abort_handler()
174 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
178 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
180 rtn = scsi_try_to_abort_cmd(sdev->host->hostt, scmd); in scmd_eh_abort_handler()
182 set_host_byte(scmd, DID_TIME_OUT); in scmd_eh_abort_handler()
185 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
188 } else if (!scsi_noretry_cmd(scmd) && in scmd_eh_abort_handler()
189 scsi_cmd_retry_allowed(scmd) && in scmd_eh_abort_handler()
190 scsi_eh_should_retry_cmd(scmd)) { in scmd_eh_abort_handler()
192 scmd_printk(KERN_WARNING, scmd, in scmd_eh_abort_handler()
194 scsi_eh_complete_abort(scmd, sdev->host); in scmd_eh_abort_handler()
195 scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); in scmd_eh_abort_handler()
199 scmd_printk(KERN_WARNING, scmd, in scmd_eh_abort_handler()
201 scsi_eh_complete_abort(scmd, sdev->host); in scmd_eh_abort_handler()
202 scsi_finish_command(scmd); in scmd_eh_abort_handler()
207 scmd_printk(KERN_INFO, scmd, in scmd_eh_abort_handler()
215 list_del_init(&scmd->eh_entry); in scmd_eh_abort_handler()
217 scsi_eh_scmd_add(scmd); in scmd_eh_abort_handler()
227 scsi_abort_command(struct scsi_cmnd *scmd) in scsi_abort_command() argument
229 struct scsi_device *sdev = scmd->device; in scsi_abort_command()
233 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { in scsi_abort_command()
238 scmd_printk(KERN_INFO, scmd, in scsi_abort_command()
240 BUG_ON(delayed_work_pending(&scmd->abort_work)); in scsi_abort_command()
247 BUG_ON(!list_empty(&scmd->eh_entry)); in scsi_abort_command()
248 list_add_tail(&scmd->eh_entry, &shost->eh_abort_list); in scsi_abort_command()
251 scmd->eh_eflags |= SCSI_EH_ABORT_SCHEDULED; in scsi_abort_command()
253 scmd_printk(KERN_INFO, scmd, "abort scheduled\n")); in scsi_abort_command()
254 queue_delayed_work(shost->tmf_work_q, &scmd->abort_work, HZ / 100); in scsi_abort_command()
266 static void scsi_eh_reset(struct scsi_cmnd *scmd) in scsi_eh_reset() argument
268 if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { in scsi_eh_reset()
269 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); in scsi_eh_reset()
271 sdrv->eh_reset(scmd); in scsi_eh_reset()
277 struct scsi_cmnd *scmd = container_of(head, typeof(*scmd), rcu); in scsi_eh_inc_host_failed() local
278 struct Scsi_Host *shost = scmd->device->host; in scsi_eh_inc_host_failed()
291 void scsi_eh_scmd_add(struct scsi_cmnd *scmd) in scsi_eh_scmd_add() argument
293 struct Scsi_Host *shost = scmd->device->host; in scsi_eh_scmd_add()
307 scsi_eh_reset(scmd); in scsi_eh_scmd_add()
308 list_add_tail(&scmd->eh_entry, &shost->eh_cmd_q); in scsi_eh_scmd_add()
314 call_rcu(&scmd->rcu, scsi_eh_inc_host_failed); in scsi_eh_scmd_add()
329 struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(req); in scsi_times_out() local
331 struct Scsi_Host *host = scmd->device->host; in scsi_times_out()
333 trace_scsi_dispatch_cmd_timeout(scmd); in scsi_times_out()
334 scsi_log_completion(scmd, TIMEOUT_ERROR); in scsi_times_out()
340 rtn = host->hostt->eh_timed_out(scmd); in scsi_times_out()
355 if (test_and_set_bit(SCMD_STATE_COMPLETE, &scmd->state)) in scsi_times_out()
357 if (scsi_abort_command(scmd) != SUCCESS) { in scsi_times_out()
358 set_host_byte(scmd, DID_TIME_OUT); in scsi_times_out()
359 scsi_eh_scmd_add(scmd); in scsi_times_out()
398 struct scsi_cmnd *scmd; in scsi_eh_prt_fail_stats() local
406 list_for_each_entry(scmd, work_q, eh_entry) { in scsi_eh_prt_fail_stats()
407 if (scmd->device == sdev) { in scsi_eh_prt_fail_stats()
409 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) in scsi_eh_prt_fail_stats()
524 enum scsi_disposition scsi_check_sense(struct scsi_cmnd *scmd) in scsi_check_sense() argument
526 struct scsi_device *sdev = scmd->device; in scsi_check_sense()
529 if (! scsi_command_normalize_sense(scmd, &sshdr)) in scsi_check_sense()
546 if (scmd->cmnd[0] == TEST_UNIT_READY && in scsi_check_sense()
547 scmd->submitter != SUBMITTED_BY_SCSI_ERROR_HANDLER) in scsi_check_sense()
561 if (scmd->sense_buffer[2] & 0xe0) in scsi_check_sense()
570 (scmd->sense_buffer[8] == 0x4) && in scsi_check_sense()
571 (scmd->sense_buffer[11] & 0xe0)) in scsi_check_sense()
600 if (scmd->device->expecting_cc_ua) { in scsi_check_sense()
608 scmd->device->expecting_cc_ua = 0; in scsi_check_sense()
617 if (scmd->device->sdev_target->expecting_lun_change && in scsi_check_sense()
630 if (scmd->device->allow_restart && in scsi_check_sense()
643 set_host_byte(scmd, DID_ALLOC_FAILURE); in scsi_check_sense()
651 set_host_byte(scmd, DID_TARGET_FAILURE); in scsi_check_sense()
658 set_host_byte(scmd, DID_MEDIUM_ERROR); in scsi_check_sense()
664 if (scmd->device->retry_hwerror) in scsi_check_sense()
667 set_host_byte(scmd, DID_TARGET_FAILURE); in scsi_check_sense()
677 set_host_byte(scmd, DID_TARGET_FAILURE); in scsi_check_sense()
750 static enum scsi_disposition scsi_eh_completed_normally(struct scsi_cmnd *scmd) in scsi_eh_completed_normally() argument
756 if (host_byte(scmd->result) == DID_RESET) { in scsi_eh_completed_normally()
763 return scsi_check_sense(scmd); in scsi_eh_completed_normally()
765 if (host_byte(scmd->result) != DID_OK) in scsi_eh_completed_normally()
772 switch (get_status_byte(scmd)) { in scsi_eh_completed_normally()
774 scsi_handle_queue_ramp_up(scmd->device); in scsi_eh_completed_normally()
779 return scsi_check_sense(scmd); in scsi_eh_completed_normally()
788 if (scmd->cmnd[0] == TEST_UNIT_READY) in scsi_eh_completed_normally()
795 scsi_handle_queue_full(scmd->device); in scsi_eh_completed_normally()
809 void scsi_eh_done(struct scsi_cmnd *scmd) in scsi_eh_done() argument
813 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_done()
814 "%s result: %x\n", __func__, scmd->result)); in scsi_eh_done()
816 eh_action = scmd->device->host->eh_action; in scsi_eh_done()
825 static enum scsi_disposition scsi_try_host_reset(struct scsi_cmnd *scmd) in scsi_try_host_reset() argument
829 struct Scsi_Host *host = scmd->device->host; in scsi_try_host_reset()
838 rtn = hostt->eh_host_reset_handler(scmd); in scsi_try_host_reset()
844 scsi_report_bus_reset(host, scmd_channel(scmd)); in scsi_try_host_reset()
855 static enum scsi_disposition scsi_try_bus_reset(struct scsi_cmnd *scmd) in scsi_try_bus_reset() argument
859 struct Scsi_Host *host = scmd->device->host; in scsi_try_bus_reset()
862 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_try_bus_reset()
868 rtn = hostt->eh_bus_reset_handler(scmd); in scsi_try_bus_reset()
874 scsi_report_bus_reset(host, scmd_channel(scmd)); in scsi_try_bus_reset()
897 static enum scsi_disposition scsi_try_target_reset(struct scsi_cmnd *scmd) in scsi_try_target_reset() argument
901 struct Scsi_Host *host = scmd->device->host; in scsi_try_target_reset()
907 rtn = hostt->eh_target_reset_handler(scmd); in scsi_try_target_reset()
910 __starget_for_each_device(scsi_target(scmd->device), NULL, in scsi_try_target_reset()
928 static enum scsi_disposition scsi_try_bus_device_reset(struct scsi_cmnd *scmd) in scsi_try_bus_device_reset() argument
931 struct scsi_host_template *hostt = scmd->device->host->hostt; in scsi_try_bus_device_reset()
936 rtn = hostt->eh_device_reset_handler(scmd); in scsi_try_bus_device_reset()
938 __scsi_report_device_reset(scmd->device, NULL); in scsi_try_bus_device_reset()
960 scsi_try_to_abort_cmd(struct scsi_host_template *hostt, struct scsi_cmnd *scmd) in scsi_try_to_abort_cmd() argument
965 return hostt->eh_abort_handler(scmd); in scsi_try_to_abort_cmd()
968 static void scsi_abort_eh_cmnd(struct scsi_cmnd *scmd) in scsi_abort_eh_cmnd() argument
970 if (scsi_try_to_abort_cmd(scmd->device->host->hostt, scmd) != SUCCESS) in scsi_abort_eh_cmnd()
971 if (scsi_try_bus_device_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
972 if (scsi_try_target_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
973 if (scsi_try_bus_reset(scmd) != SUCCESS) in scsi_abort_eh_cmnd()
974 scsi_try_host_reset(scmd); in scsi_abort_eh_cmnd()
991 void scsi_eh_prep_cmnd(struct scsi_cmnd *scmd, struct scsi_eh_save *ses, in scsi_eh_prep_cmnd() argument
994 struct scsi_device *sdev = scmd->device; in scsi_eh_prep_cmnd()
1003 ses->cmd_len = scmd->cmd_len; in scsi_eh_prep_cmnd()
1004 ses->cmnd = scmd->cmnd; in scsi_eh_prep_cmnd()
1005 ses->data_direction = scmd->sc_data_direction; in scsi_eh_prep_cmnd()
1006 ses->sdb = scmd->sdb; in scsi_eh_prep_cmnd()
1007 ses->result = scmd->result; in scsi_eh_prep_cmnd()
1008 ses->resid_len = scmd->req.resid_len; in scsi_eh_prep_cmnd()
1009 ses->underflow = scmd->underflow; in scsi_eh_prep_cmnd()
1010 ses->prot_op = scmd->prot_op; in scsi_eh_prep_cmnd()
1011 ses->eh_eflags = scmd->eh_eflags; in scsi_eh_prep_cmnd()
1013 scmd->prot_op = SCSI_PROT_NORMAL; in scsi_eh_prep_cmnd()
1014 scmd->eh_eflags = 0; in scsi_eh_prep_cmnd()
1015 scmd->cmnd = ses->eh_cmnd; in scsi_eh_prep_cmnd()
1016 memset(scmd->cmnd, 0, BLK_MAX_CDB); in scsi_eh_prep_cmnd()
1017 memset(&scmd->sdb, 0, sizeof(scmd->sdb)); in scsi_eh_prep_cmnd()
1018 scmd->result = 0; in scsi_eh_prep_cmnd()
1019 scmd->req.resid_len = 0; in scsi_eh_prep_cmnd()
1022 scmd->sdb.length = min_t(unsigned, SCSI_SENSE_BUFFERSIZE, in scsi_eh_prep_cmnd()
1024 sg_init_one(&ses->sense_sgl, scmd->sense_buffer, in scsi_eh_prep_cmnd()
1025 scmd->sdb.length); in scsi_eh_prep_cmnd()
1026 scmd->sdb.table.sgl = &ses->sense_sgl; in scsi_eh_prep_cmnd()
1027 scmd->sc_data_direction = DMA_FROM_DEVICE; in scsi_eh_prep_cmnd()
1028 scmd->sdb.table.nents = scmd->sdb.table.orig_nents = 1; in scsi_eh_prep_cmnd()
1029 scmd->cmnd[0] = REQUEST_SENSE; in scsi_eh_prep_cmnd()
1030 scmd->cmnd[4] = scmd->sdb.length; in scsi_eh_prep_cmnd()
1031 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_prep_cmnd()
1033 scmd->sc_data_direction = DMA_NONE; in scsi_eh_prep_cmnd()
1036 memcpy(scmd->cmnd, cmnd, cmnd_size); in scsi_eh_prep_cmnd()
1037 scmd->cmd_len = COMMAND_SIZE(scmd->cmnd[0]); in scsi_eh_prep_cmnd()
1041 scmd->underflow = 0; in scsi_eh_prep_cmnd()
1044 scmd->cmnd[1] = (scmd->cmnd[1] & 0x1f) | in scsi_eh_prep_cmnd()
1051 memset(scmd->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE); in scsi_eh_prep_cmnd()
1062 void scsi_eh_restore_cmnd(struct scsi_cmnd* scmd, struct scsi_eh_save *ses) in scsi_eh_restore_cmnd() argument
1067 scmd->cmd_len = ses->cmd_len; in scsi_eh_restore_cmnd()
1068 scmd->cmnd = ses->cmnd; in scsi_eh_restore_cmnd()
1069 scmd->sc_data_direction = ses->data_direction; in scsi_eh_restore_cmnd()
1070 scmd->sdb = ses->sdb; in scsi_eh_restore_cmnd()
1071 scmd->result = ses->result; in scsi_eh_restore_cmnd()
1072 scmd->req.resid_len = ses->resid_len; in scsi_eh_restore_cmnd()
1073 scmd->underflow = ses->underflow; in scsi_eh_restore_cmnd()
1074 scmd->prot_op = ses->prot_op; in scsi_eh_restore_cmnd()
1075 scmd->eh_eflags = ses->eh_eflags; in scsi_eh_restore_cmnd()
1093 static enum scsi_disposition scsi_send_eh_cmnd(struct scsi_cmnd *scmd, in scsi_send_eh_cmnd() argument
1096 struct scsi_device *sdev = scmd->device; in scsi_send_eh_cmnd()
1105 scsi_eh_prep_cmnd(scmd, &ses, cmnd, cmnd_size, sense_bytes); in scsi_send_eh_cmnd()
1108 scsi_log_send(scmd); in scsi_send_eh_cmnd()
1109 scmd->submitter = SUBMITTED_BY_SCSI_ERROR_HANDLER; in scsi_send_eh_cmnd()
1128 rtn = shost->hostt->queuecommand(shost, scmd); in scsi_send_eh_cmnd()
1135 scsi_eh_restore_cmnd(scmd, &ses); in scsi_send_eh_cmnd()
1151 scsi_log_completion(scmd, rtn); in scsi_send_eh_cmnd()
1153 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_send_eh_cmnd()
1167 rtn = scsi_eh_completed_normally(scmd); in scsi_send_eh_cmnd()
1168 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_send_eh_cmnd()
1184 scsi_abort_eh_cmnd(scmd); in scsi_send_eh_cmnd()
1188 scsi_eh_restore_cmnd(scmd, &ses); in scsi_send_eh_cmnd()
1202 static enum scsi_disposition scsi_request_sense(struct scsi_cmnd *scmd) in scsi_request_sense() argument
1204 return scsi_send_eh_cmnd(scmd, NULL, 0, scmd->device->eh_timeout, ~0); in scsi_request_sense()
1208 scsi_eh_action(struct scsi_cmnd *scmd, enum scsi_disposition rtn) in scsi_eh_action() argument
1210 if (!blk_rq_is_passthrough(scsi_cmd_to_rq(scmd))) { in scsi_eh_action()
1211 struct scsi_driver *sdrv = scsi_cmd_to_driver(scmd); in scsi_eh_action()
1213 rtn = sdrv->eh_action(scmd, rtn); in scsi_eh_action()
1230 void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) in scsi_eh_finish_cmd() argument
1232 list_move_tail(&scmd->eh_entry, done_q); in scsi_eh_finish_cmd()
1259 struct scsi_cmnd *scmd, *next; in scsi_eh_get_sense() local
1267 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_get_sense()
1268 if ((scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) || in scsi_eh_get_sense()
1269 SCSI_SENSE_VALID(scmd)) in scsi_eh_get_sense()
1272 shost = scmd->device->host; in scsi_eh_get_sense()
1275 scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1280 if (!scsi_status_is_check_condition(scmd->result)) in scsi_eh_get_sense()
1289 SCSI_LOG_ERROR_RECOVERY(2, scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1292 rtn = scsi_request_sense(scmd); in scsi_eh_get_sense()
1296 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_get_sense()
1297 "sense requested, result %x\n", scmd->result)); in scsi_eh_get_sense()
1298 SCSI_LOG_ERROR_RECOVERY(3, scsi_print_sense(scmd)); in scsi_eh_get_sense()
1300 rtn = scsi_decide_disposition(scmd); in scsi_eh_get_sense()
1315 if (scmd->allowed == SCSI_CMD_RETRIES_NO_LIMIT) in scsi_eh_get_sense()
1316 scmd->retries = scmd->allowed = 1; in scsi_eh_get_sense()
1318 scmd->retries = scmd->allowed; in scsi_eh_get_sense()
1322 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_get_sense()
1336 static int scsi_eh_tur(struct scsi_cmnd *scmd) in scsi_eh_tur() argument
1343 rtn = scsi_send_eh_cmnd(scmd, tur_command, 6, in scsi_eh_tur()
1344 scmd->device->eh_timeout, 0); in scsi_eh_tur()
1346 SCSI_LOG_ERROR_RECOVERY(3, scmd_printk(KERN_INFO, scmd, in scsi_eh_tur()
1378 struct scsi_cmnd *scmd, *next; in scsi_eh_test_devices() local
1383 scmd = list_entry(cmd_list->next, struct scsi_cmnd, eh_entry); in scsi_eh_test_devices()
1384 sdev = scmd->device; in scsi_eh_test_devices()
1398 finish_cmds = !scsi_device_online(scmd->device) || in scsi_eh_test_devices()
1399 (try_stu && !scsi_eh_try_stu(scmd) && in scsi_eh_test_devices()
1400 !scsi_eh_tur(scmd)) || in scsi_eh_test_devices()
1401 !scsi_eh_tur(scmd); in scsi_eh_test_devices()
1403 list_for_each_entry_safe(scmd, next, cmd_list, eh_entry) in scsi_eh_test_devices()
1404 if (scmd->device == sdev) { in scsi_eh_test_devices()
1407 scsi_eh_action(scmd, SUCCESS) == SUCCESS)) in scsi_eh_test_devices()
1408 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_test_devices()
1410 list_move_tail(&scmd->eh_entry, work_q); in scsi_eh_test_devices()
1423 static int scsi_eh_try_stu(struct scsi_cmnd *scmd) in scsi_eh_try_stu() argument
1427 if (scmd->device->allow_restart) { in scsi_eh_try_stu()
1432 rtn = scsi_send_eh_cmnd(scmd, stu_command, 6, scmd->device->request_queue->rq_timeout, 0); in scsi_eh_try_stu()
1455 struct scsi_cmnd *scmd, *stu_scmd, *next; in scsi_eh_stu() local
1468 list_for_each_entry(scmd, work_q, eh_entry) in scsi_eh_stu()
1469 if (scmd->device == sdev && SCSI_SENSE_VALID(scmd) && in scsi_eh_stu()
1470 scsi_check_sense(scmd) == FAILED ) { in scsi_eh_stu()
1471 stu_scmd = scmd; in scsi_eh_stu()
1486 list_for_each_entry_safe(scmd, next, in scsi_eh_stu()
1488 if (scmd->device == sdev && in scsi_eh_stu()
1489 scsi_eh_action(scmd, SUCCESS) == SUCCESS) in scsi_eh_stu()
1490 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_stu()
1521 struct scsi_cmnd *scmd, *bdr_scmd, *next; in scsi_eh_bus_device_reset() local
1535 list_for_each_entry(scmd, work_q, eh_entry) in scsi_eh_bus_device_reset()
1536 if (scmd->device == sdev) { in scsi_eh_bus_device_reset()
1537 bdr_scmd = scmd; in scsi_eh_bus_device_reset()
1552 list_for_each_entry_safe(scmd, next, in scsi_eh_bus_device_reset()
1554 if (scmd->device == sdev && in scsi_eh_bus_device_reset()
1555 scsi_eh_action(scmd, rtn) != FAILED) in scsi_eh_bus_device_reset()
1556 scsi_eh_finish_cmd(scmd, in scsi_eh_bus_device_reset()
1589 struct scsi_cmnd *next, *scmd; in scsi_eh_target_reset() local
1604 scmd = list_entry(tmp_list.next, struct scsi_cmnd, eh_entry); in scsi_eh_target_reset()
1605 id = scmd_id(scmd); in scsi_eh_target_reset()
1611 rtn = scsi_try_target_reset(scmd); in scsi_eh_target_reset()
1618 list_for_each_entry_safe(scmd, next, &tmp_list, eh_entry) { in scsi_eh_target_reset()
1619 if (scmd_id(scmd) != id) in scsi_eh_target_reset()
1623 list_move_tail(&scmd->eh_entry, &check_list); in scsi_eh_target_reset()
1625 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_target_reset()
1628 list_move(&scmd->eh_entry, work_q); in scsi_eh_target_reset()
1645 struct scsi_cmnd *scmd, *chan_scmd, *next; in scsi_eh_bus_reset() local
1668 list_for_each_entry(scmd, work_q, eh_entry) { in scsi_eh_bus_reset()
1669 if (channel == scmd_channel(scmd)) { in scsi_eh_bus_reset()
1670 chan_scmd = scmd; in scsi_eh_bus_reset()
1687 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_bus_reset()
1688 if (channel == scmd_channel(scmd)) { in scsi_eh_bus_reset()
1690 scsi_eh_finish_cmd(scmd, in scsi_eh_bus_reset()
1693 list_move_tail(&scmd->eh_entry, in scsi_eh_bus_reset()
1717 struct scsi_cmnd *scmd, *next; in scsi_eh_host_reset() local
1722 scmd = list_entry(work_q->next, in scsi_eh_host_reset()
1730 rtn = scsi_try_host_reset(scmd); in scsi_eh_host_reset()
1734 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_host_reset()
1735 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_host_reset()
1755 struct scsi_cmnd *scmd, *next; in scsi_eh_offline_sdevs() local
1758 list_for_each_entry_safe(scmd, next, work_q, eh_entry) { in scsi_eh_offline_sdevs()
1759 sdev_printk(KERN_INFO, scmd->device, "Device offlined - " in scsi_eh_offline_sdevs()
1761 sdev = scmd->device; in scsi_eh_offline_sdevs()
1767 scsi_eh_finish_cmd(scmd, done_q); in scsi_eh_offline_sdevs()
1776 int scsi_noretry_cmd(struct scsi_cmnd *scmd) in scsi_noretry_cmd() argument
1778 struct request *req = scsi_cmd_to_rq(scmd); in scsi_noretry_cmd()
1780 switch (host_byte(scmd->result)) { in scsi_noretry_cmd()
1790 if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) in scsi_noretry_cmd()
1797 if (!scsi_status_is_check_condition(scmd->result)) in scsi_noretry_cmd()
1825 enum scsi_disposition scsi_decide_disposition(struct scsi_cmnd *scmd) in scsi_decide_disposition() argument
1833 if (!scsi_device_online(scmd->device)) { in scsi_decide_disposition()
1834 SCSI_LOG_ERROR_RECOVERY(5, scmd_printk(KERN_INFO, scmd, in scsi_decide_disposition()
1843 switch (host_byte(scmd->result)) { in scsi_decide_disposition()
1850 scmd->result &= 0xff00ffff; in scsi_decide_disposition()
1858 if (scmd->eh_eflags & SCSI_EH_ABORT_SCHEDULED) { in scsi_decide_disposition()
1859 set_host_byte(scmd, DID_TIME_OUT); in scsi_decide_disposition()
1905 if (get_status_byte(scmd) == SAM_STAT_RESERVATION_CONFLICT) in scsi_decide_disposition()
1921 if ((scmd->cmnd[0] == TEST_UNIT_READY || in scsi_decide_disposition()
1922 scmd->cmnd[0] == INQUIRY)) { in scsi_decide_disposition()
1936 switch (get_status_byte(scmd)) { in scsi_decide_disposition()
1938 scsi_handle_queue_full(scmd->device); in scsi_decide_disposition()
1953 if (scmd->cmnd[0] == REPORT_LUNS) in scsi_decide_disposition()
1954 scmd->device->sdev_target->expecting_lun_change = 0; in scsi_decide_disposition()
1955 scsi_handle_queue_ramp_up(scmd->device); in scsi_decide_disposition()
1962 rtn = scsi_check_sense(scmd); in scsi_decide_disposition()
1980 sdev_printk(KERN_INFO, scmd->device, in scsi_decide_disposition()
1982 set_host_byte(scmd, DID_NEXUS_FAILURE); in scsi_decide_disposition()
1995 if (scsi_cmd_retry_allowed(scmd) && !scsi_noretry_cmd(scmd)) { in scsi_decide_disposition()
2136 struct scsi_cmnd *scmd, *next; in scsi_eh_flush_done_q() local
2138 list_for_each_entry_safe(scmd, next, done_q, eh_entry) { in scsi_eh_flush_done_q()
2139 list_del_init(&scmd->eh_entry); in scsi_eh_flush_done_q()
2140 if (scsi_device_online(scmd->device) && in scsi_eh_flush_done_q()
2141 !scsi_noretry_cmd(scmd) && scsi_cmd_retry_allowed(scmd) && in scsi_eh_flush_done_q()
2142 scsi_eh_should_retry_cmd(scmd)) { in scsi_eh_flush_done_q()
2144 scmd_printk(KERN_INFO, scmd, in scsi_eh_flush_done_q()
2147 scsi_queue_insert(scmd, SCSI_MLQUEUE_EH_RETRY); in scsi_eh_flush_done_q()
2154 if (!scmd->result) in scsi_eh_flush_done_q()
2155 scmd->result |= (DID_TIME_OUT << 16); in scsi_eh_flush_done_q()
2157 scmd_printk(KERN_INFO, scmd, in scsi_eh_flush_done_q()
2160 scsi_finish_command(scmd); in scsi_eh_flush_done_q()
2374 struct scsi_cmnd *scmd; in scsi_ioctl_reset() local
2398 scmd = (struct scsi_cmnd *)(rq + 1); in scsi_ioctl_reset()
2399 scsi_init_command(dev, scmd); in scsi_ioctl_reset()
2400 scmd->cmnd = scsi_req(rq)->cmd; in scsi_ioctl_reset()
2402 scmd->submitter = SUBMITTED_BY_SCSI_RESET_IOCTL; in scsi_ioctl_reset()
2403 memset(&scmd->sdb, 0, sizeof(scmd->sdb)); in scsi_ioctl_reset()
2405 scmd->cmd_len = 0; in scsi_ioctl_reset()
2407 scmd->sc_data_direction = DMA_BIDIRECTIONAL; in scsi_ioctl_reset()
2418 rtn = scsi_try_bus_device_reset(scmd); in scsi_ioctl_reset()
2423 rtn = scsi_try_target_reset(scmd); in scsi_ioctl_reset()
2428 rtn = scsi_try_bus_reset(scmd); in scsi_ioctl_reset()
2433 rtn = scsi_try_host_reset(scmd); in scsi_ioctl_reset()