Bug 191381 - LIO ignores XCOPY source and destination descriptor IDs
Summary: LIO ignores XCOPY source and destination descriptor IDs
Alias: None
Product: IO/Storage
Classification: Unclassified
Component: SCSI (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: linux-scsi@vger.kernel.org
Depends on:
Reported: 2016-12-28 17:10 UTC by David Disseldorp
Modified: 2017-01-13 10:42 UTC (History)
0 users

See Also:
Kernel Version: 4.9.0
Tree: Mainline
Regression: No


Description David Disseldorp 2016-12-28 17:10:29 UTC
The EXTENDED COPY SCSI command (XCOPY) is used extensively by VMware ESX initiators, to offload to the iSCSI target, the process of copying data between a source and destination LU region.
XCOPY is also supported by other initiators, such as ddpt (http://sg.danny.cz/sg/ddpt.html), libiscsi, etc.

The XCOPY specification in SPC-4 (revision 37) states that the XCOPY source and destination device(s) should be derived from the copy source and copy destination descriptor (CSCD) IDs in the XCOPY segment descriptor. The CSCD IDs are generally (for block -> block copies), indexes into the corresponding CSCD list, i.e.

XCOPY Header    
- entry 0
  + LU ID
- entry 2
  + LU ID
Segment Descriptor List
- segment 0
  + src CSCD ID = (CSCD entry 0)
  + dest CSCD ID = (CSCD entry 1)
  + len
  + src lba
  + dest lba

Currently LIO completely ignores the src and dest CSCD IDs in the Segment Descriptor List, and instead assumes that the first entry in the CSCD list corresponds to the source, and the second to the destination.

This assumption appears to stand true for XCOPY requests from ESXi initiators. However, deviation from the spec may break other initiators - it causes a number of libiscsi tests to fail.
Comment 1 David Disseldorp 2017-01-02 01:20:35 UTC
I've pushed a reproducer to:

Usage is:
examples/iscsi-dd --xcopy --src iscsi://<iqn>/<src_lun> --dst iscsi://<iqn>/<dst_lun>

iscsi-dd has been modified to issue XCOPY requests with the CSCD List order modified such that the destination (specified via segment descriptor ID) appears before the source.

Note You need to log in before you can comment on or make changes to this bug.