vhost_scsi: check for task allocation failure

Change-Id: I03e63985907d7330373b1883652cd27a0cf466db
Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/369081
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Pawel Wodkowski <pawelx.wodkowski@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Daniel Verkamp 2017-07-11 15:18:36 -07:00
parent 4e003b6714
commit 0bb3618a99

View File

@ -1001,6 +1001,12 @@ alloc_task_pool(struct spdk_vhost_scsi_dev *svdev)
for (i = 0; i < task_cnt; ++i) {
task = spdk_dma_zmalloc(sizeof(*task), SPDK_CACHE_LINE_SIZE, NULL);
if (task == NULL) {
SPDK_ERRLOG("Controller %s: Failed to allocate task\n", svdev->vdev.name);
free_task_pool(svdev);
return -1;
}
rc = spdk_ring_enqueue(svdev->task_pool, (void **)&task, 1);
if (rc != 1) {
SPDK_ERRLOG("Controller %s: Failed to alloc %"PRIu32" vhost scsi tasks\n", svdev->vdev.name,