vhost/nvme: fix error handling of session start
Session start callbacks have technically two ways of returning an error code: a) as the callback return value, e.g. return -1 b) via vhost_session_start_done(int rc) The former doesn't have any effect as that return value is not checked anywhere. It's only present because we wanted to use the same function signature as for the foreach_session() callbacks. It's going to be cleaned up in subsequent patches, but before that happens we have to fix vhost_nvme. With vhost_session_start_done(-1) called, DPDK will terminate the entire socket connection. Change-Id: Ib1eff17a67eef055b0dc89fa13d1fed2f8a1fbf0 Signed-off-by: Vitaliy Mysak <vitaliy.mysak@intel.com> Signed-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/467230 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
81883ec5a7
commit
606b453fcd
@ -1082,13 +1082,16 @@ spdk_vhost_nvme_start_cb(struct spdk_vhost_dev *vdev,
|
||||
struct spdk_vhost_nvme_dev *nvme = to_nvme_dev(vdev);
|
||||
struct spdk_vhost_nvme_ns *ns_dev;
|
||||
uint32_t i;
|
||||
int rc = 0;
|
||||
|
||||
if (nvme == NULL) {
|
||||
return -1;
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (alloc_task_pool(nvme)) {
|
||||
return -1;
|
||||
rc = alloc_task_pool(nvme);
|
||||
if (rc) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
SPDK_NOTICELOG("Start Device %u, Path %s, lcore %d\n", vsession->vid,
|
||||
@ -1098,7 +1101,8 @@ spdk_vhost_nvme_start_cb(struct spdk_vhost_dev *vdev,
|
||||
ns_dev = &nvme->ns[i];
|
||||
ns_dev->bdev_io_channel = spdk_bdev_get_io_channel(ns_dev->bdev_desc);
|
||||
if (!ns_dev->bdev_io_channel) {
|
||||
return -1;
|
||||
rc = -1;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1106,8 +1110,9 @@ spdk_vhost_nvme_start_cb(struct spdk_vhost_dev *vdev,
|
||||
/* Start the NVMe Poller */
|
||||
nvme->requestq_poller = spdk_poller_register(nvme_worker, nvme, 0);
|
||||
|
||||
vhost_session_start_done(vsession, 0);
|
||||
return 0;
|
||||
out:
|
||||
vhost_session_start_done(vsession, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
x
Reference in New Issue
Block a user