iscsi: Fix the bug when querying DIF context for Data In PDU

spdk_iscsi_get_dif_ctx() didn't work correctly for Data In PDU
because we had to get iSCSI task from PDU directly for Data In PDU,
and lun_id was not copied in spdk_iscsi_task_get().

This patch fixes these bugs and the DIF strip feature was verified
after applying this patch.

Change-Id: I74d404b82c4a9502a9a8e166748f817d3c2e4368
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447884
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Shuhei Matsumoto 2019-03-13 17:45:21 +09:00 committed by Jim Harris
parent 1151e65dc1
commit 1bec7d572c
2 changed files with 15 additions and 6 deletions

View File

@ -4686,16 +4686,12 @@ spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
lun_id = spdk_islun2lun(lun);
break;
}
case ISCSI_OP_SCSI_DATAIN:
case ISCSI_OP_SCSI_DATAOUT: {
/* Location of Buffer Offset and TTT in PDU are same
* for Data In and Out, so unify them.
*/
struct iscsi_bhs_data_in *dbhs;
struct iscsi_bhs_data_out *dbhs;
struct spdk_iscsi_task *task;
int transfer_tag;
dbhs = (struct iscsi_bhs_data_in *)bhs;
dbhs = (struct iscsi_bhs_data_out *)bhs;
offset = from_be32(&dbhs->buffer_offset);
transfer_tag = from_be32(&dbhs->ttt);
task = spdk_get_transfer_task(conn, transfer_tag);
@ -4706,6 +4702,18 @@ spdk_iscsi_get_dif_ctx(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu,
lun_id = task->lun_id;
break;
}
case ISCSI_OP_SCSI_DATAIN: {
struct iscsi_bhs_data_in *dbhs;
struct spdk_iscsi_task *task;
dbhs = (struct iscsi_bhs_data_in *)bhs;
offset = from_be32(&dbhs->buffer_offset);
task = pdu->task;
assert(task != NULL);
cdb = task->scsi.cdb;
lun_id = task->lun_id;
break;
}
default:
return false;
}

View File

@ -76,6 +76,7 @@ spdk_iscsi_task_get(struct spdk_iscsi_conn *conn, struct spdk_iscsi_task *parent
parent->scsi.ref++;
task->parent = parent;
task->tag = parent->tag;
task->lun_id = parent->lun_id;
task->scsi.dxfer_dir = parent->scsi.dxfer_dir;
task->scsi.transfer_len = parent->scsi.transfer_len;
task->scsi.lun = parent->scsi.lun;