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,9 +198,10 @@ spdk_scsi_dev_queue_task(struct spdk_scsi_dev *dev,
|
|||||||
{
|
{
|
||||||
assert(task != NULL);
|
assert(task != NULL);
|
||||||
|
|
||||||
/* ready to enqueue, disk is valid for LUN access */
|
if (spdk_scsi_lun_append_task(task->lun, task) == 0) {
|
||||||
spdk_scsi_lun_append_task(task->lun, task);
|
/* ready to execute, disk is valid for LUN access */
|
||||||
spdk_scsi_lun_execute_tasks(task->lun);
|
spdk_scsi_lun_execute_tasks(task->lun);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -223,15 +223,16 @@ complete_task_with_no_lun(struct spdk_scsi_task *task)
|
|||||||
spdk_scsi_lun_complete_task(NULL, 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)
|
spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
|
||||||
{
|
{
|
||||||
if (lun == NULL) {
|
if (lun == NULL) {
|
||||||
complete_task_with_no_lun(task);
|
complete_task_with_no_lun(task);
|
||||||
return;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_INSERT_TAIL(&lun->pending_tasks, task, scsi_link);
|
TAILQ_INSERT_TAIL(&lun->pending_tasks, task, scsi_link);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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);
|
_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_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);
|
void spdk_scsi_lun_execute_tasks(struct spdk_scsi_lun *lun);
|
||||||
int spdk_scsi_lun_task_mgmt_execute(struct spdk_scsi_task *task);
|
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);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
|
spdk_scsi_lun_append_task(struct spdk_scsi_lun *lun, struct spdk_scsi_task *task)
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user