bdev/nvme: NVMe probe ctx free change for async bdevs creation

If specific NVMe mode requires asynchronous bdevs
creation we cannot free probe ctx until all bdevs
are created.

Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
Change-Id: Ie758f2fa8068c4090b7ce76c73967483441166cd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468453
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Maciej Szwed 2019-09-16 08:54:30 +02:00 committed by Jim Harris
parent 81d6bcd02c
commit 63c2e95c42

View File

@ -1213,6 +1213,8 @@ create_bdevs_cb(void *cb_arg, size_t count, int rc)
if (ctx->cb_fn) {
ctx->cb_fn(ctx->cb_ctx, count, rc);
}
free(ctx);
}
static void
@ -1265,6 +1267,8 @@ connect_attach_cb(void *cb_ctx, const struct spdk_nvme_transport_id *trid,
ctx = SPDK_CONTAINEROF(user_opts, struct nvme_async_probe_ctx, opts);
spdk_poller_unregister(&ctx->poller);
rc = create_ctrlr(ctrlr, ctx->base_name, &ctx->trid, ctx->prchk_flags);
if (rc) {
SPDK_ERRLOG("Failed to create new device\n");
@ -1283,15 +1287,9 @@ static int
bdev_nvme_async_poll(void *arg)
{
struct nvme_async_probe_ctx *ctx = arg;
int done;
done = spdk_nvme_probe_poll_async(ctx->probe_ctx);
/* retry again */
if (done == -EAGAIN) {
return 1;
}
spdk_poller_unregister(&ctx->poller);
free(ctx);
spdk_nvme_probe_poll_async(ctx->probe_ctx);
return 1;
}