aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_xcopy.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2017-01-02 18:04:09 +0100
committerBart Van Assche <bart.vanassche@sandisk.com>2017-01-10 08:41:30 -0800
commit87156518da94a696f2b27ab8945d531af2f1d339 (patch)
tree8eb04eaa72f635ae3891401853d1802b66b1136c /drivers/target/target_core_xcopy.c
parenttarget: check for XCOPY parameter truncation (diff)
downloadlinux-dev-87156518da94a696f2b27ab8945d531af2f1d339.tar.xz
linux-dev-87156518da94a696f2b27ab8945d531af2f1d339.zip
target: support XCOPY requests without parameters
SPC4r37 6.4.1 EXTENDED COPY(LID4) states (also applying to LID1 reqs): A parameter list length of zero specifies that the copy manager shall not transfer any data or alter any internal state, and this shall not be considered an error. This behaviour can be tested using the libiscsi ExtendedCopy.ParamHdr test. Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Diffstat (limited to 'drivers/target/target_core_xcopy.c')
-rw-r--r--drivers/target/target_core_xcopy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/target/target_core_xcopy.c b/drivers/target/target_core_xcopy.c
index a9a6462c66d1..d828b3b5000b 100644
--- a/drivers/target/target_core_xcopy.c
+++ b/drivers/target/target_core_xcopy.c
@@ -888,6 +888,10 @@ sense_reason_t target_do_xcopy(struct se_cmd *se_cmd)
return TCM_UNSUPPORTED_SCSI_OPCODE;
}
+ if (se_cmd->data_length == 0) {
+ target_complete_cmd(se_cmd, SAM_STAT_GOOD);
+ return TCM_NO_SENSE;
+ }
if (se_cmd->data_length < XCOPY_HDR_LEN) {
pr_err("XCOPY parameter truncation: length %u < hdr_len %u\n",
se_cmd->data_length, XCOPY_HDR_LEN);