diff --git a/include/spdk/scsi.h b/include/spdk/scsi.h index ac06c8770..85e80a22d 100644 --- a/include/spdk/scsi.h +++ b/include/spdk/scsi.h @@ -98,11 +98,7 @@ struct spdk_scsi_task { uint8_t status; uint8_t function; /* task mgmt function */ uint8_t response; /* task mgmt response */ - /** - * Record the lun id just in case the lun is invalid, - * which will happen when hot remove the lun. - */ - int lun_id; + struct spdk_scsi_lun *lun; struct spdk_bdev_desc *desc; struct spdk_io_channel *ch; diff --git a/lib/iscsi/iscsi.c b/lib/iscsi/iscsi.c index b8274ede0..b90160b06 100644 --- a/lib/iscsi/iscsi.c +++ b/lib/iscsi/iscsi.c @@ -2896,7 +2896,7 @@ int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) assert(task->current_datain_offset <= task->scsi.transfer_len); if (task->current_datain_offset == 0) { - task->scsi.lun = spdk_scsi_dev_get_lun(conn->dev, task->scsi.lun_id); + task->scsi.lun = spdk_scsi_dev_get_lun(conn->dev, task->lun_id); if (task->scsi.lun == NULL) { TAILQ_REMOVE(&conn->queued_datain_tasks, task, link); spdk_scsi_task_process_null_lun(&task->scsi); @@ -2921,7 +2921,7 @@ int spdk_iscsi_conn_handle_queued_datain_tasks(struct spdk_iscsi_conn *conn) task->current_datain_offset += subtask->scsi.length; conn->data_in_cnt++; - task->scsi.lun = spdk_scsi_dev_get_lun(conn->dev, task->scsi.lun_id); + task->scsi.lun = spdk_scsi_dev_get_lun(conn->dev, task->lun_id); if (task->scsi.lun == NULL) { /* Remove the primary task from the list if this is the last subtask */ if (task->current_datain_offset == task->scsi.transfer_len) { @@ -3005,7 +3005,7 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu) spdk_iscsi_task_associate_pdu(task, pdu); lun_i = spdk_islun2lun(lun); - task->scsi.lun_id = lun_i; + task->lun_id = lun_i; dev = conn->dev; task->scsi.lun = spdk_scsi_dev_get_lun(dev, lun_i); diff --git a/lib/iscsi/task.h b/lib/iscsi/task.h index 7d5df1849..127f94135 100644 --- a/lib/iscsi/task.h +++ b/lib/iscsi/task.h @@ -84,6 +84,12 @@ struct spdk_iscsi_task { uint32_t tag; + /** + * Record the lun id just in case the lun is invalid, + * which will happen when hot removing the lun. + */ + int lun_id; + TAILQ_ENTRY(spdk_iscsi_task) link; TAILQ_HEAD(subtask_list, spdk_iscsi_task) subtask_list;