scsi: fix panic issue of spdk_scsi_dev_queue_task
When task->lun is NULL, spdk_scsi_dev_queue_task panics. This patch fixes it.
This commit is contained in:
parent
987ba616fa
commit
81d60e6f30
@ -198,10 +198,11 @@ spdk_scsi_dev_queue_task(struct spdk_scsi_dev *dev,
|
||||
{
|
||||
assert(task != NULL);
|
||||
|
||||
/* ready to enqueue, disk is valid for LUN access */
|
||||
spdk_scsi_lun_append_task(task->lun, task);
|
||||
if (spdk_scsi_lun_append_task(task->lun, task) == 0) {
|
||||
/* ready to execute, disk is valid for LUN access */
|
||||
spdk_scsi_lun_execute_tasks(task->lun);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
spdk_scsi_dev_add_port(struct spdk_scsi_dev *dev, uint64_t id, const char *name)
|
||||
|
@ -223,15 +223,16 @@ complete_task_with_no_lun(struct spdk_scsi_task *task)
|
||||
spdk_scsi_lun_complete_task(NULL, task);
|
||||
}
|
||||
|
||||
void
|
||||
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;
|
||||
return -1;
|
||||
}
|
||||
|
||||
TAILQ_INSERT_TAIL(&lun->pending_tasks, task, scsi_link);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -77,7 +77,7 @@ typedef struct spdk_scsi_lun _spdk_scsi_lun;
|
||||
_spdk_scsi_lun *spdk_scsi_lun_construct(const char *name, struct spdk_bdev *bdev);
|
||||
|
||||
void spdk_scsi_lun_clear_all(struct spdk_scsi_lun *lun);
|
||||
void spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
|
||||
int spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
|
||||
void spdk_scsi_lun_execute_tasks(struct spdk_scsi_lun *lun);
|
||||
int spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task);
|
||||
void spdk_scsi_lun_complete_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task);
|
||||
|
@ -107,9 +107,10 @@ spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user