855633a597
A major SCSI compliance test expects that the LUN field is reserved (not to be checked) in the SCSI Data-Out PDU. In that test, the LUN field in the first SCSI Command PDU is 0 and the LUN field in the SCSI Data-Out PDU sent in response to the R2T is 0xFFFFFFFFFFFFFFFF. The TTT field in the SCSI Data-Out PDU is 0xF that is copied from the R2T. 0xF is valid as TTT. Hence spdk_iscsi_op_data() returns Check Condition because LUN is not found. This patch changes to get LUN ID from not the LUN field in the SCSI Data-Out PDU but the saved task. The following is excerpts from iSCSI specification (RFC7143). The behavior of the SCSI compliance test looks against the specification but changing SPDK will be safer. 11.7.4. Target Transfer Tag and LUN On outgoing data, the Target Transfer Tag is provided to the target if the transfer is honoring an R2T. In this case, the Target Transfer Tag field is a replica of the Target Transfer Tag provided with the R2T. On incoming data, the Target Transfer Tag and LUN MUST be provided by the target if the A bit is set to 1; otherwise, they are reserved. The Target Transfer Tag and LUN are copied by the initiator into the SNACK of type DataACK that it issues as a result of receiving a SCSI Data-In PDU with the A bit set to 1. The Target Transfer Tag values are not specified by this protocol, except that the value 0xffffffff is reserved and means that the Target Transfer Tag is not supplied. If the Target Transfer Tag is provided, then the LUN field MUST hold a valid value and be consistent with whatever was specified with the command; otherwise, the LUN field is reserved. Change-Id: I110a7e396d1e517b2a39ca5e586ab2bb2d45e5f3 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/425333 Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>