diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index 1c6dd571a..f7a8c9c69 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -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; } diff --git a/lib/iscsi/task.c b/lib/iscsi/task.c index 6b56cd978..1a9a192c6 100644 --- a/lib/iscsi/task.c +++ b/lib/iscsi/task.c @@ -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;