iscsi: finish the task if the lun is NULL immediately in iscsi layer.
This patch make the function spdk_scsi_task_process_null_lun() as public and finish the task immediately once we get task in iscsi layer. Change-Id: I4ada027d3a324dce8ef0d0f7706dbc14184ead96 Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
This commit is contained in:
parent
c932e122b7
commit
b21fd06463
@ -293,6 +293,7 @@ void spdk_scsi_task_build_sense_data(struct spdk_scsi_task *task, int sk, int as
|
||||
int ascq);
|
||||
void spdk_scsi_task_set_status(struct spdk_scsi_task *task, int sc, int sk, int asc,
|
||||
int ascq);
|
||||
void spdk_scsi_task_process_null_lun(struct spdk_scsi_task *task);
|
||||
|
||||
static inline struct spdk_scsi_task *
|
||||
spdk_scsi_task_get_primary(struct spdk_scsi_task *task)
|
||||
|
@ -2956,6 +2956,12 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
|
||||
task->scsi.initiator_port = conn->initiator_port;
|
||||
task->scsi.parent = NULL;
|
||||
|
||||
if (task->scsi.lun == NULL) {
|
||||
spdk_scsi_task_process_null_lun(&task->scsi);
|
||||
process_task_completion(conn, task);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* no bi-directional support */
|
||||
if (R_bit) {
|
||||
return spdk_iscsi_op_scsi_read(conn, task);
|
||||
|
@ -179,13 +179,14 @@ spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void
|
||||
complete_task_with_no_lun(struct spdk_scsi_task *task)
|
||||
void
|
||||
spdk_scsi_task_process_null_lun(struct spdk_scsi_task *task)
|
||||
{
|
||||
uint8_t buffer[36];
|
||||
uint32_t allocation_len;
|
||||
uint32_t data_len;
|
||||
|
||||
task->length = task->transfer_len;
|
||||
if (task->cdb[0] == SPDK_SPC_INQUIRY) {
|
||||
/*
|
||||
* SPC-4 states that INQUIRY commands to an unsupported LUN
|
||||
@ -213,17 +214,11 @@ complete_task_with_no_lun(struct spdk_scsi_task *task)
|
||||
SPDK_SCSI_ASCQ_CAUSE_NOT_REPORTABLE);
|
||||
task->data_transferred = 0;
|
||||
}
|
||||
spdk_scsi_lun_complete_task(NULL, task);
|
||||
}
|
||||
|
||||
int
|
||||
spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
|
||||
{
|
||||
if (lun == NULL) {
|
||||
complete_task_with_no_lun(task);
|
||||
return -1;
|
||||
}
|
||||
|
||||
TAILQ_INSERT_TAIL(&lun->pending_tasks, task, scsi_link);
|
||||
return 0;
|
||||
}
|
||||
|
@ -59,6 +59,11 @@ spdk_get_pdu(void)
|
||||
return pdu;
|
||||
}
|
||||
|
||||
void
|
||||
spdk_scsi_task_process_null_lun(struct spdk_scsi_task *task)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
spdk_scsi_dev_queue_task(struct spdk_scsi_dev *dev,
|
||||
struct spdk_scsi_task *task)
|
||||
|
@ -443,7 +443,7 @@ lun_append_task_null_lun_task_cdb_spc_inquiry(void)
|
||||
task->cdb[4] = 0xFF;
|
||||
task->lun = NULL;
|
||||
|
||||
spdk_scsi_lun_append_task(NULL, task);
|
||||
spdk_scsi_task_process_null_lun(task);
|
||||
|
||||
CU_ASSERT_EQUAL(task->status, SPDK_SCSI_STATUS_GOOD);
|
||||
|
||||
@ -466,7 +466,7 @@ lun_append_task_null_lun_alloc_len_lt_4096(void)
|
||||
task->cdb[4] = 0;
|
||||
/* alloc_len is set to a minimal value of 4096
|
||||
* Hence, rbuf of size 4096 is allocated*/
|
||||
spdk_scsi_lun_append_task(NULL, task);
|
||||
spdk_scsi_task_process_null_lun(task);
|
||||
|
||||
CU_ASSERT_EQUAL(task->status, SPDK_SCSI_STATUS_GOOD);
|
||||
|
||||
@ -485,7 +485,7 @@ lun_append_task_null_lun_not_supported(void)
|
||||
task->cdb = cdb;
|
||||
task->lun = NULL;
|
||||
|
||||
spdk_scsi_lun_append_task(NULL, task);
|
||||
spdk_scsi_task_process_null_lun(task);
|
||||
|
||||
CU_ASSERT_EQUAL(task->status, SPDK_SCSI_STATUS_CHECK_CONDITION);
|
||||
/* LUN not supported; task's data transferred should be 0 */
|
||||
|
Loading…
Reference in New Issue
Block a user