]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
target: support XCOPY requests without parameters
authorDavid Disseldorp <ddiss@suse.de>
Mon, 2 Jan 2017 17:04:09 +0000 (18:04 +0100)
committerBart Van Assche <bart.vanassche@sandisk.com>
Tue, 10 Jan 2017 16:41:30 +0000 (08:41 -0800)
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>
drivers/target/target_core_xcopy.c

index a9a6462c66d1cf6966a5a95dd3e71514e82e46bd..d828b3b5000bf421826b9823efcbac8d6b2d58a3 100644 (file)
@@ -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);