@@ -828,7 +828,12 @@ static void target_queue_cmd_work(struct se_cmd_queue *q, struct se_cmd *se_cmd,
static void target_queue_cmd_compl(struct se_cmd *se_cmd)
{
struct se_device *se_dev = se_cmd->se_dev;
- int cpu = se_cmd->cpuid;
+ int cpu;
+
+ if (se_cmd->se_cmd_flags & SCF_IGNORE_CPUID_COMPL)
+ cpu = smp_processor_id();
+ else
+ cpu = se_cmd->cpuid;
target_queue_cmd_work(&se_dev->queues[cpu].cq, se_cmd, cpu,
target_completion_wq);
@@ -1609,6 +1614,9 @@ target_submit_prep(struct se_cmd *se_cmd, struct se_session *se_sess,
BUG_ON(!se_tpg);
BUG_ON(se_cmd->se_tfo || se_cmd->se_sess);
+ if (flags & TARGET_SCF_IGNORE_CPUID_COMPL)
+ se_cmd->se_cmd_flags |= SCF_IGNORE_CPUID_COMPL;
+
if (flags & TARGET_SCF_USE_CPUID)
se_cmd->se_cmd_flags |= SCF_USE_CPUID;
/*
@@ -803,7 +803,8 @@ static void vhost_scsi_target_queue_cmd(struct vhost_scsi_cmd *cmd)
&cmd->tvc_sense_buf[0], cmd->tvc_lun,
cmd->tvc_exp_data_len,
vhost_scsi_to_tcm_attr(cmd->tvc_task_attr),
- cmd->tvc_data_direction, TARGET_SCF_ACK_KREF,
+ cmd->tvc_data_direction,
+ TARGET_SCF_ACK_KREF | TARGET_SCF_IGNORE_CPUID_COMPL,
sg_ptr, cmd->tvc_sgl_count, NULL, 0, sg_prot_ptr,
cmd->tvc_prot_sgl_count);
if (rc < 0) {
@@ -146,6 +146,7 @@ enum se_cmd_flags_table {
SCF_USE_CPUID = (1 << 16),
SCF_TASK_ATTR_SET = (1 << 17),
SCF_TREAT_READ_AS_NORMAL = (1 << 18),
+ SCF_IGNORE_CPUID_COMPL = (1 << 19)
};
/*
@@ -195,6 +196,7 @@ enum target_sc_flags_table {
TARGET_SCF_ACK_KREF = 0x02,
TARGET_SCF_UNKNOWN_SIZE = 0x04,
TARGET_SCF_USE_CPUID = 0x08,
+ TARGET_SCF_IGNORE_CPUID_COMPL = 0x10,
};
/* fabric independent task management function values */