Commit acb3f260 authored by Nicholas Bellinger's avatar Nicholas Bellinger

target: Reject EXTENDED_COPY when emulate_3pc is disabled

This patch rejects EXTENDED_COPY when the emulate_3pc attribute has
been explicitly disabled for the receiving device.

It also adds a similar check in target_xcopy_locate_se_dev_e4() to
ignore these devices when doing a search based upon the identifier
WWN provided by EXTENDED_COPY parameter list target descriptors.
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 3f7a46c6
...@@ -82,6 +82,9 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op ...@@ -82,6 +82,9 @@ static int target_xcopy_locate_se_dev_e4(struct se_cmd *se_cmd, struct xcopy_op
mutex_lock(&g_device_mutex); mutex_lock(&g_device_mutex);
list_for_each_entry(se_dev, &g_device_list, g_dev_node) { list_for_each_entry(se_dev, &g_device_list, g_dev_node) {
if (!se_dev->dev_attrib.emulate_3pc)
continue;
memset(&tmp_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN); memset(&tmp_dev_wwn[0], 0, XCOPY_NAA_IEEE_REGEX_LEN);
target_xcopy_gen_naa_ieee(se_dev, &tmp_dev_wwn[0]); target_xcopy_gen_naa_ieee(se_dev, &tmp_dev_wwn[0]);
...@@ -884,12 +887,18 @@ static void target_xcopy_do_work(struct work_struct *work) ...@@ -884,12 +887,18 @@ static void target_xcopy_do_work(struct work_struct *work)
sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) sense_reason_t target_do_xcopy(struct se_cmd *se_cmd)
{ {
struct se_device *dev = se_cmd->se_dev;
struct xcopy_op *xop = NULL; struct xcopy_op *xop = NULL;
unsigned char *p = NULL, *seg_desc; unsigned char *p = NULL, *seg_desc;
unsigned int list_id, list_id_usage, sdll, inline_dl, sa; unsigned int list_id, list_id_usage, sdll, inline_dl, sa;
int rc; int rc;
unsigned short tdll; unsigned short tdll;
if (!dev->dev_attrib.emulate_3pc) {
pr_err("EXTENDED_COPY operation explicitly disabled\n");
return TCM_UNSUPPORTED_SCSI_OPCODE;
}
sa = se_cmd->t_task_cdb[1] & 0x1f; sa = se_cmd->t_task_cdb[1] & 0x1f;
if (sa != 0x00) { if (sa != 0x00) {
pr_err("EXTENDED_COPY(LID4) not supported\n"); pr_err("EXTENDED_COPY(LID4) not supported\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment