Commit 48502ddb authored by Nicholas Bellinger's avatar Nicholas Bellinger

target: Fail XCOPY for non matching source + destination block_size

This patch adds an explicit check + failure for XCOPY I/O to source +
destination devices with a non-matching block_size.

This limitiation is currently due to the fact that the scatterlist
memory allocated for the XCOPY READ operation is passed zero-copy
to the XCOPY WRITE operation.
Reported-by: default avatarThomas Glanzmann <thomas@glanzmann.de>
Reported-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
Cc: Thomas Glanzmann <thomas@glanzmann.de>
Cc: Douglas Gilbert <dgilbert@interlog.com>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent 8a955d6d
...@@ -893,6 +893,7 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) ...@@ -893,6 +893,7 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd)
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;
sense_reason_t ret = TCM_INVALID_PARAMETER_LIST;
int rc; int rc;
unsigned short tdll; unsigned short tdll;
...@@ -944,6 +945,17 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) ...@@ -944,6 +945,17 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd)
if (rc <= 0) if (rc <= 0)
goto out; goto out;
if (xop->src_dev->dev_attrib.block_size !=
xop->dst_dev->dev_attrib.block_size) {
pr_err("XCOPY: Non matching src_dev block_size: %u + dst_dev"
" block_size: %u currently unsupported\n",
xop->src_dev->dev_attrib.block_size,
xop->dst_dev->dev_attrib.block_size);
xcopy_pt_undepend_remotedev(xop);
ret = TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE;
goto out;
}
pr_debug("XCOPY: Processed %d target descriptors, length: %u\n", rc, pr_debug("XCOPY: Processed %d target descriptors, length: %u\n", rc,
rc * XCOPY_TARGET_DESC_LEN); rc * XCOPY_TARGET_DESC_LEN);
seg_desc = &p[16]; seg_desc = &p[16];
...@@ -966,7 +978,7 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd) ...@@ -966,7 +978,7 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd)
if (p) if (p)
transport_kunmap_data_sg(se_cmd); transport_kunmap_data_sg(se_cmd);
kfree(xop); kfree(xop);
return TCM_INVALID_PARAMETER_LIST; return ret;
} }
static sense_reason_t target_rcr_operating_parameters(struct se_cmd *se_cmd) static sense_reason_t target_rcr_operating_parameters(struct se_cmd *se_cmd)
......
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