29 #include <linux/net.h>
31 #include <linux/string.h>
33 #include <linux/slab.h>
38 #include <linux/cdrom.h>
39 #include <linux/module.h>
41 #include <asm/unaligned.h>
44 #include <scsi/scsi.h>
67 static void transport_complete_task_attr(
struct se_cmd *
cmd);
68 static void transport_handle_queue_full(
struct se_cmd *
cmd,
70 static int transport_generic_get_mem(
struct se_cmd *
cmd);
72 static void transport_put_cmd(
struct se_cmd *
cmd);
82 pr_err(
"kmem_cache_create() for struct se_session"
87 sizeof(
struct se_ua), __alignof__(
struct se_ua),
90 pr_err(
"kmem_cache_create() for struct se_ua failed\n");
91 goto out_free_sess_cache;
96 if (!t10_pr_reg_cache) {
97 pr_err(
"kmem_cache_create() for struct t10_pr_registration"
99 goto out_free_ua_cache;
104 if (!t10_alua_lu_gp_cache) {
105 pr_err(
"kmem_cache_create() for t10_alua_lu_gp_cache"
107 goto out_free_pr_reg_cache;
112 if (!t10_alua_lu_gp_mem_cache) {
113 pr_err(
"kmem_cache_create() for t10_alua_lu_gp_mem_"
115 goto out_free_lu_gp_cache;
120 if (!t10_alua_tg_pt_gp_cache) {
121 pr_err(
"kmem_cache_create() for t10_alua_tg_pt_gp_"
123 goto out_free_lu_gp_mem_cache;
126 "t10_alua_tg_pt_gp_mem_cache",
130 if (!t10_alua_tg_pt_gp_mem_cache) {
131 pr_err(
"kmem_cache_create() for t10_alua_tg_pt_gp_"
133 goto out_free_tg_pt_gp_cache;
138 if (!target_completion_wq)
139 goto out_free_tg_pt_gp_mem_cache;
143 out_free_tg_pt_gp_mem_cache:
145 out_free_tg_pt_gp_cache:
147 out_free_lu_gp_mem_cache:
149 out_free_lu_gp_cache:
151 out_free_pr_reg_cache:
186 spin_lock(&scsi_mib_index_lock);
187 new_index = ++scsi_mib_index[
type];
188 spin_unlock(&scsi_mib_index_lock);
196 static int sub_api_initialized;
198 if (sub_api_initialized)
201 ret = request_module(
"target_core_iblock");
203 pr_err(
"Unable to load target_core_iblock\n");
205 ret = request_module(
"target_core_file");
207 pr_err(
"Unable to load target_core_file\n");
209 ret = request_module(
"target_core_pscsi");
211 pr_err(
"Unable to load target_core_pscsi\n");
213 sub_api_initialized = 1;
220 se_sess = kmem_cache_zalloc(se_sess_cache,
GFP_KERNEL);
222 pr_err(
"Unable to allocate struct se_session from"
262 se_tpg->
se_tpg_tfo->sess_get_initiator_sid(se_sess,
281 pr_debug(
"TARGET_CORE[%s]: Registered fabric_sess_ptr: %p\n",
327 static void target_complete_nacl(
struct kref *
kref)
337 kref_put(&nacl->
acl_kref, target_complete_nacl);
381 bool comp_nacl =
true;
417 pr_debug(
"TARGET_CORE[%s]: Deregistered fabric_sess\n",
424 if (se_nacl && comp_nacl ==
true)
434 static void target_remove_from_state_list(
struct se_cmd *
cmd)
453 static int transport_cmd_check_stop(
struct se_cmd *cmd,
bool remove_from_lists)
463 pr_debug(
"%s:%d CMD_T_LUN_STOP for ITT: 0x%08x\n",
464 __func__, __LINE__, cmd->
se_tfo->get_task_tag(cmd));
467 if (remove_from_lists)
468 target_remove_from_state_list(cmd);
475 if (remove_from_lists) {
476 target_remove_from_state_list(cmd);
489 pr_debug(
"%s:%d CMD_T_STOP for ITT: 0x%08x\n",
491 cmd->
se_tfo->get_task_tag(cmd));
500 if (remove_from_lists) {
512 return cmd->
se_tfo->check_stop_free(cmd);
520 static int transport_cmd_check_stop_to_fabric(
struct se_cmd *cmd)
522 return transport_cmd_check_stop(cmd,
true);
525 static void transport_lun_remove_cmd(
struct se_cmd *cmd)
536 target_remove_from_state_list(cmd);
549 transport_lun_remove_cmd(cmd);
551 if (transport_cmd_check_stop_to_fabric(cmd))
554 transport_put_cmd(cmd);
568 static unsigned char *transport_get_sense_buffer(
struct se_cmd *cmd)
582 pr_debug(
"HBA_[%u]_PLUG[%s]: Requesting sense for SAM STATUS: 0x%02x\n",
590 int success = scsi_status ==
GOOD;
599 if (dev && dev->
transport->transport_complete) {
602 transport_get_sense_buffer(cmd));
643 static void target_add_to_state_list(
struct se_cmd *cmd)
659 static void transport_write_pending_qf(
struct se_cmd *cmd);
660 static void transport_complete_qf(
struct se_cmd *cmd);
678 pr_debug(
"Processing %s cmd: %p QUEUE_FULL in work queue"
679 " context: %s\n", cmd->
se_tfo->get_fabric_name(),
cmd,
685 transport_write_pending_qf(cmd);
687 transport_complete_qf(cmd);
714 *bl +=
sprintf(b + *bl,
"Status: ");
717 *bl +=
sprintf(b + *bl,
"ACTIVATED");
720 *bl +=
sprintf(b + *bl,
"DEACTIVATED");
723 *bl +=
sprintf(b + *bl,
"SHUTDOWN");
727 *bl +=
sprintf(b + *bl,
"OFFLINE");
735 *bl +=
sprintf(b + *bl,
" SectorSize: %u HwMaxSectors: %u\n",
737 dev->
se_sub_dev->se_dev_attrib.hw_max_sectors);
743 unsigned char *p_buf,
750 len =
sprintf(buf,
"T10 VPD Protocol Identifier: ");
754 sprintf(buf+len,
"Fibre Channel\n");
757 sprintf(buf+len,
"Parallel SCSI\n");
763 sprintf(buf+len,
"IEEE 1394\n");
766 sprintf(buf+len,
"SCSI Remote Direct Memory Access"
770 sprintf(buf+len,
"Internet SCSI (iSCSI)\n");
773 sprintf(buf+len,
"SAS Serial SCSI Protocol\n");
776 sprintf(buf+len,
"Automation/Drive Interface Transport"
780 sprintf(buf+len,
"AT Attachment Interface ATA/ATAPI\n");
783 sprintf(buf+len,
"Unknown 0x%02x\n",
789 strncpy(p_buf, buf, p_buf_len);
802 if (page_83[1] & 0x80) {
812 unsigned char *p_buf,
820 len =
sprintf(buf,
"T10 VPD Identifier Association: ");
824 sprintf(buf+len,
"addressed logical unit\n");
827 sprintf(buf+len,
"target port\n");
830 sprintf(buf+len,
"SCSI target device\n");
839 strncpy(p_buf, buf, p_buf_len);
860 unsigned char *p_buf,
868 len =
sprintf(buf,
"T10 VPD Identifier Type: ");
872 sprintf(buf+len,
"Vendor specific\n");
875 sprintf(buf+len,
"T10 Vendor ID based\n");
878 sprintf(buf+len,
"EUI-64 based\n");
884 sprintf(buf+len,
"Relative target port identifier\n");
887 sprintf(buf+len,
"SCSI name string\n");
890 sprintf(buf+len,
"Unsupported: 0x%02x\n",
897 if (p_buf_len <
strlen(buf)+1)
899 strncpy(p_buf, buf, p_buf_len);
921 unsigned char *p_buf,
931 sprintf(buf,
"T10 VPD Binary Device Identifier: %s\n",
935 sprintf(buf,
"T10 VPD ASCII Device Identifier: %s\n",
939 sprintf(buf,
"T10 VPD UTF-8 Device Identifier: %s\n",
943 sprintf(buf,
"T10 VPD Device Identifier encoding unsupported:"
950 strncpy(p_buf, buf, p_buf_len);
960 static const char hex_str[] =
"0123456789abcdef";
973 while (
i < (4 + page_83[3])) {
975 hex_str[(page_83[
i] & 0xf0) >> 4];
977 hex_str[page_83[
i] & 0x0f];
983 while (
i < (4 + page_83[3]))
994 static void core_setup_task_attr_emulation(
struct se_device *dev)
1009 pr_debug(
"%s: Using SAM_TASK_ATTR_EMULATED for SPC: 0x%02x"
1014 static void scsi_dump_inquiry(
struct se_device *dev)
1022 for (i = 0; i < 8; i++)
1023 if (wwn->
vendor[i] >= 0x20)
1030 for (i = 0; i < 16; i++)
1031 if (wwn->
model[i] >= 0x20)
1038 for (i = 0; i < 4; i++)
1046 device_type = dev->
transport->get_device_type(dev);
1048 pr_debug(
" ANSI SCSI revision: %02x\n",
1057 void *transport_dev,
1059 const char *inquiry_prod,
1060 const char *inquiry_rev)
1067 pr_err(
"Unable to allocate memory for se_dev_t\n");
1105 core_setup_task_attr_emulation(dev);
1126 pr_err(
"Unable to create tmr workqueue for %s\n",
1143 if (!inquiry_prod || !inquiry_rev) {
1144 pr_err(
"All non TCM/pSCSI plugins require"
1145 " INQUIRY consts\n");
1153 scsi_dump_inquiry(dev);
1180 pr_warn(
"TARGET_CORE[%s]: Expected Transfer Length:"
1181 " %u does not match SCSI CDB Length: %u for SAM Opcode:"
1182 " 0x%02x\n", cmd->
se_tfo->get_fabric_name(),
1186 pr_err(
"Rejecting underflow/overflow"
1188 goto out_invalid_cdb_field;
1194 if (dev->
se_sub_dev->se_dev_attrib.block_size != 512) {
1195 pr_err(
"Failing OVERFLOW/UNDERFLOW for LBA op"
1196 " CDB on non 512-byte sector setup subsystem"
1199 goto out_invalid_cdb_field;
1219 out_invalid_cdb_field:
1236 unsigned char *sense_buffer)
1262 static int transport_check_alloc_task_attr(
struct se_cmd *cmd)
1273 " emulation is not supported\n");
1282 pr_debug(
"Allocated se_ordered_id: %u for Task Attr: 0x%02x on %s\n",
1284 cmd->
se_dev->transport->name);
1297 u32 pr_reg_type = 0;
1299 unsigned long flags;
1307 pr_err(
"Received SCSI CDB with command_size: %d that"
1308 " exceeds SCSI_MAX_VARLEN_CDB_SIZE: %d\n",
1319 if (scsi_command_size(cdb) >
sizeof(cmd->
__t_task_cdb)) {
1320 cmd->
t_task_cdb = kzalloc(scsi_command_size(cdb),
1323 pr_err(
"Unable to allocate cmd->t_task_cdb"
1324 " %u > sizeof(cmd->__t_task_cdb): %lu ops\n",
1325 scsi_command_size(cdb),
1348 ret = su_dev->
t10_alua.alua_state_check(cmd, cdb, &alua_ascq);
1356 pr_debug(
"[%s]: ALUA TG Port not available, "
1357 "SenseKey: NOT_READY, ASC/ASCQ: "
1359 cmd->
se_tfo->get_fabric_name(), alua_ascq);
1361 transport_set_sense_codes(cmd, 0x04, alua_ascq);
1374 if (su_dev->
t10_pr.pr_ops.t10_reservation_check(cmd, &pr_reg_type)) {
1375 if (su_dev->
t10_pr.pr_ops.t10_seq_non_holder(
1376 cmd, cdb, pr_reg_type) != 0) {
1390 ret = cmd->
se_dev->transport->parse_cdb(cmd);
1401 if (transport_check_alloc_task_attr(cmd) < 0) {
1406 spin_lock(&cmd->
se_lun->lun_sep_lock);
1407 if (cmd->
se_lun->lun_sep)
1408 cmd->
se_lun->lun_sep->sep_stats.cmd_pdus++;
1409 spin_unlock(&cmd->
se_lun->lun_sep_lock);
1425 pr_err(
"cmd->se_lun is NULL\n");
1430 pr_err(
"transport_generic_handle_cdb cannot be called"
1431 " from interrupt context\n");
1484 unsigned char *
cdb,
unsigned char *
sense,
u32 unpacked_lun,
1492 se_tpg = se_sess->
se_tpg;
1502 data_length, data_dir, task_attr, sense);
1539 if (sgl_count != 0) {
1552 unsigned char *buf =
NULL;
1564 sgl_bidi, sgl_bidi_count);
1604 unsigned char *
cdb,
unsigned char *
sense,
u32 unpacked_lun,
1608 unpacked_lun, data_length, task_attr, data_dir,
1613 static void target_complete_tmr_failure(
struct work_struct *work)
1618 se_cmd->
se_tfo->queue_tm_rsp(se_cmd);
1639 unsigned char *
sense,
u32 unpacked_lun,
1640 void *fabric_tmr_ptr,
unsigned char tm_type,
1641 gfp_t gfp,
unsigned int tag,
int flags)
1646 se_tpg = se_sess->
se_tpg;
1690 bool was_active =
false;
1696 pr_debug(
"cmd %p waiting to complete\n", cmd);
1698 pr_debug(
"cmd %p stopped successfully\n", cmd);
1716 pr_debug(
"-----[ Storage Engine Exception for cmd: %p ITT: 0x%08x"
1717 " CDB: 0x%02x\n", cmd, cmd->
se_tfo->get_task_tag(cmd),
1719 pr_debug(
"-----[ i_state: %d t_state: %d scsi_sense_reason: %d\n",
1720 cmd->
se_tfo->get_cmd_state(cmd),
1722 pr_debug(
"-----[ CMD_T_ACTIVE: %d CMD_T_STOP: %d CMD_T_SENT: %d\n",
1731 transport_complete_task_attr(cmd);
1762 cmd->
se_dev->se_sub_dev->se_dev_attrib.emulate_ua_intlck_ctrl == 2)
1767 ret = cmd->
se_tfo->queue_status(cmd);
1772 pr_err(
"Unknown transport error for CDB 0x%02x: %d\n",
1784 transport_lun_remove_cmd(cmd);
1785 if (!transport_cmd_check_stop_to_fabric(cmd))
1791 transport_handle_queue_full(cmd, cmd->
se_dev);
1795 static void __target_execute_cmd(
struct se_cmd *cmd)
1833 pr_debug(
"%s:%d CMD_T_LUN_STOP for ITT: 0x%08x\n",
1834 __func__, __LINE__, cmd->
se_tfo->get_task_tag(cmd));
1846 pr_debug(
"%s:%d CMD_T_STOP for ITT: 0x%08x\n",
1848 cmd->
se_tfo->get_task_tag(cmd));
1867 pr_debug(
"Added HEAD_OF_QUEUE for CDB: 0x%02x, "
1868 "se_ordered_id: %u\n",
1875 pr_debug(
"Added ORDERED for CDB: 0x%02x to ordered list, "
1876 " se_ordered_id: %u\n",
1900 pr_debug(
"Added CDB: 0x%02x Task Attr: 0x%02x to"
1901 " delayed CMD list, se_ordered_id: %u\n",
1911 __target_execute_cmd(cmd);
1919 static void target_restart_delayed_cmds(
struct se_device *dev)
1935 __target_execute_cmd(cmd);
1946 static void transport_complete_task_attr(
struct se_cmd *cmd)
1954 pr_debug(
"Incremented dev->dev_cur_ordered_id: %u for"
1959 pr_debug(
"Incremented dev_cur_ordered_id: %u for"
1967 pr_debug(
"Incremented dev_cur_ordered_id: %u for ORDERED:"
1971 target_restart_delayed_cmds(dev);
1974 static void transport_complete_qf(
struct se_cmd *cmd)
1979 transport_complete_task_attr(cmd);
1982 ret = cmd->
se_tfo->queue_status(cmd);
1989 ret = cmd->
se_tfo->queue_data_in(cmd);
1993 ret = cmd->
se_tfo->queue_data_in(cmd);
1999 ret = cmd->
se_tfo->queue_status(cmd);
2007 transport_handle_queue_full(cmd, cmd->
se_dev);
2010 transport_lun_remove_cmd(cmd);
2011 transport_cmd_check_stop_to_fabric(cmd);
2014 static void transport_handle_queue_full(
2022 spin_unlock_irq(&cmd->
se_dev->qf_cmd_lock);
2027 static void target_complete_ok_work(
struct work_struct *work)
2029 struct se_cmd *cmd =
container_of(work,
struct se_cmd, work);
2038 transport_complete_task_attr(cmd);
2057 transport_lun_remove_cmd(cmd);
2058 transport_cmd_check_stop_to_fabric(cmd);
2070 spin_lock(&cmd->
se_lun->lun_sep_lock);
2071 if (cmd->
se_lun->lun_sep) {
2072 cmd->
se_lun->lun_sep->sep_stats.tx_data_octets +=
2075 spin_unlock(&cmd->
se_lun->lun_sep_lock);
2077 ret = cmd->
se_tfo->queue_data_in(cmd);
2082 spin_lock(&cmd->
se_lun->lun_sep_lock);
2083 if (cmd->
se_lun->lun_sep) {
2084 cmd->
se_lun->lun_sep->sep_stats.rx_data_octets +=
2087 spin_unlock(&cmd->
se_lun->lun_sep_lock);
2092 spin_lock(&cmd->
se_lun->lun_sep_lock);
2093 if (cmd->
se_lun->lun_sep) {
2094 cmd->
se_lun->lun_sep->sep_stats.tx_data_octets +=
2097 spin_unlock(&cmd->
se_lun->lun_sep_lock);
2098 ret = cmd->
se_tfo->queue_data_in(cmd);
2105 ret = cmd->
se_tfo->queue_status(cmd);
2113 transport_lun_remove_cmd(cmd);
2114 transport_cmd_check_stop_to_fabric(cmd);
2118 pr_debug(
"Handling complete_ok QUEUE_FULL: se_cmd: %p,"
2121 transport_handle_queue_full(cmd, cmd->
se_dev);
2124 static inline void transport_free_sgl(
struct scatterlist *
sgl,
int nents)
2135 static
inline void transport_free_pages(
struct se_cmd *cmd)
2140 transport_free_sgl(cmd->t_data_sg, cmd->t_data_nents);
2141 cmd->t_data_sg =
NULL;
2142 cmd->t_data_nents = 0;
2144 transport_free_sgl(cmd->t_bidi_data_sg, cmd->t_bidi_data_nents);
2145 cmd->t_bidi_data_sg =
NULL;
2146 cmd->t_bidi_data_nents = 0;
2156 static void transport_release_cmd(
struct se_cmd *cmd)
2172 cmd->
se_tfo->release_cmd(cmd);
2181 static void transport_put_cmd(
struct se_cmd *cmd)
2183 unsigned long flags;
2193 target_remove_from_state_list(cmd);
2197 transport_free_pages(cmd);
2198 transport_release_cmd(cmd);
2223 if (!sgl || !sgl_count)
2232 pr_warn(
"Rejecting SCSI DATA overflow for fabric using"
2233 " SCF_PASSTHROUGH_SG_TO_MEM_NOALLOC\n");
2242 if (sgl_bidi && sgl_bidi_count) {
2278 pages[
i] = sg_page(sg);
2307 transport_generic_get_mem(
struct se_cmd *cmd)
2331 sg_set_page(&cmd->
t_data_sg[i], page, page_len, 0);
2363 ret = transport_generic_get_mem(cmd);
2375 target_add_to_state_list(cmd);
2385 transport_cmd_check_stop(cmd,
false);
2387 ret = cmd->
se_tfo->write_pending(cmd);
2400 pr_debug(
"Handling write_pending QUEUE__FULL: se_cmd: %p\n", cmd);
2402 transport_handle_queue_full(cmd, cmd->
se_dev);
2407 static void transport_write_pending_qf(
struct se_cmd *cmd)
2411 ret = cmd->
se_tfo->write_pending(cmd);
2413 pr_debug(
"Handling write_pending QUEUE__FULL: se_cmd: %p\n",
2415 transport_handle_queue_full(cmd, cmd->
se_dev);
2425 transport_release_cmd(cmd);
2433 transport_lun_remove_cmd(cmd);
2435 transport_put_cmd(cmd);
2445 static int target_get_sess_cmd(
struct se_session *se_sess,
struct se_cmd *se_cmd,
2448 unsigned long flags;
2457 if (ack_kref ==
true) {
2475 static void target_release_cmd_kref(
struct kref *
kref)
2479 unsigned long flags;
2484 se_cmd->
se_tfo->release_cmd(se_cmd);
2495 se_cmd->
se_tfo->release_cmd(se_cmd);
2504 return kref_put(&se_cmd->
cmd_kref, target_release_cmd_kref);
2515 struct se_cmd *se_cmd;
2516 unsigned long flags;
2538 struct se_cmd *se_cmd, *tmp_cmd;
2545 pr_debug(
"Waiting for se_cmd: %p t_state: %d, fabric state:"
2546 " %d\n", se_cmd, se_cmd->
t_state,
2547 se_cmd->
se_tfo->get_cmd_state(se_cmd));
2549 if (wait_for_tasks) {
2550 pr_debug(
"Calling transport_wait_for_tasks se_cmd: %p t_state: %d,"
2551 " fabric state: %d\n", se_cmd, se_cmd->
t_state,
2552 se_cmd->
se_tfo->get_cmd_state(se_cmd));
2556 pr_debug(
"After transport_wait_for_tasks se_cmd: %p t_state: %d,"
2557 " fabric state: %d\n", se_cmd, se_cmd->
t_state,
2558 se_cmd->
se_tfo->get_cmd_state(se_cmd));
2563 pr_debug(
"After cmd_wait_comp: se_cmd: %p t_state: %d"
2564 " fabric state: %d\n", se_cmd, se_cmd->
t_state,
2565 se_cmd->
se_tfo->get_cmd_state(se_cmd));
2568 se_cmd->
se_tfo->release_cmd(se_cmd);
2578 static int transport_lun_wait_for_tasks(
struct se_cmd *cmd,
struct se_lun *lun)
2580 unsigned long flags;
2591 pr_debug(
"ConfigFS ITT[0x%08x] - CMD_T_STOP, skipping\n",
2592 cmd->
se_tfo->get_task_tag(cmd));
2594 transport_cmd_check_stop(cmd,
false);
2609 pr_debug(
"ConfigFS: cmd: %p stop tasks ret:"
2612 pr_debug(
"ConfigFS: ITT[0x%08x] - stopping cmd....\n",
2613 cmd->
se_tfo->get_task_tag(cmd));
2615 pr_debug(
"ConfigFS: ITT[0x%08x] - stopped cmd....\n",
2616 cmd->
se_tfo->get_task_tag(cmd));
2622 static void __transport_clear_lun_from_sessions(
struct se_lun *lun)
2624 struct se_cmd *cmd =
NULL;
2625 unsigned long lun_flags, cmd_flags;
2637 pr_debug(
"SE_LUN[%d] - Setting cmd->transport"
2638 "_lun_stop for ITT: 0x%08x\n",
2639 cmd->
se_lun->unpacked_lun,
2640 cmd->
se_tfo->get_task_tag(cmd));
2647 pr_err(
"ITT: 0x%08x, [i,t]_state: %u/%u\n",
2648 cmd->
se_tfo->get_task_tag(cmd),
2656 pr_debug(
"SE_LUN[%d] - ITT: 0x%08x before transport"
2657 "_lun_wait_for_tasks()\n", cmd->
se_lun->unpacked_lun,
2658 cmd->
se_tfo->get_task_tag(cmd));
2660 if (transport_lun_wait_for_tasks(cmd, cmd->
se_lun) < 0) {
2665 pr_debug(
"SE_LUN[%d] - ITT: 0x%08x after transport_lun"
2666 "_wait_for_tasks(): SUCCESS\n",
2667 cmd->
se_lun->unpacked_lun,
2668 cmd->
se_tfo->get_task_tag(cmd));
2676 target_remove_from_state_list(cmd);
2695 pr_debug(
"SE_LUN[%d] - Detected FE stop for"
2696 " struct se_cmd: %p ITT: 0x%08x\n",
2698 cmd, cmd->
se_tfo->get_task_tag(cmd));
2702 transport_cmd_check_stop(cmd,
false);
2707 pr_debug(
"SE_LUN[%d] - ITT: 0x%08x finished processing\n",
2716 static int transport_clear_lun_thread(
void *
p)
2720 __transport_clear_lun_from_sessions(lun);
2733 pr_err(
"Unable to start clear_lun thread\n");
2750 unsigned long flags;
2772 pr_debug(
"wait_for_tasks: Stopping"
2773 " wait_for_completion(&cmd->t_tasktransport_lun_fe"
2774 "_stop_comp); for ITT: 0x%08x\n",
2775 cmd->
se_tfo->get_task_tag(cmd));
2788 target_remove_from_state_list(cmd);
2795 " wait_for_completion(&cmd->t_tasktransport_lun_fe_"
2796 "stop_comp); for ITT: 0x%08x\n",
2797 cmd->
se_tfo->get_task_tag(cmd));
2809 pr_debug(
"wait_for_tasks: Stopping %p ITT: 0x%08x"
2810 " i_state: %d, t_state: %d, CMD_T_STOP\n",
2811 cmd, cmd->
se_tfo->get_task_tag(cmd),
2821 pr_debug(
"wait_for_tasks: Stopped wait_for_completion("
2822 "&cmd->t_transport_stop_comp) for ITT: 0x%08x\n",
2823 cmd->
se_tfo->get_task_tag(cmd));
2831 static int transport_get_sense_codes(
2842 static int transport_set_sense_codes(
2859 unsigned long flags;
2870 if (!reason && from_transport)
2873 if (!from_transport)
3015 transport_get_sense_codes(cmd, &asc, &
ascq);
3041 return cmd->
se_tfo->queue_status(cmd);
3054 pr_debug(
"Sending delayed SAM_STAT_TASK_ABORTED"
3055 " status for CDB: 0x%02x ITT: 0x%08x\n",
3057 cmd->
se_tfo->get_task_tag(cmd));
3060 cmd->
se_tfo->queue_status(cmd);
3069 unsigned long flags;
3085 if (cmd->
se_tfo->write_pending_status(cmd) != 0) {
3092 pr_debug(
"Setting SAM_STAT_TASK_ABORTED status for CDB: 0x%02x,"
3094 cmd->
se_tfo->get_task_tag(cmd));
3096 cmd->
se_tfo->queue_status(cmd);
3099 static void target_tmr_work(
struct work_struct *work)
3101 struct se_cmd *cmd =
container_of(work,
struct se_cmd, work);
3127 pr_err(
"Uknown TMR function: 0x%02x.\n",
3134 cmd->
se_tfo->queue_tm_rsp(cmd);
3136 transport_cmd_check_stop_to_fabric(cmd);