Commit 63c2e95c authored by Maciej Szwed's avatar Maciej Szwed Committed by Jim Harris
Browse files

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: default avatarMaciej Szwed <maciej.szwed@intel.com>
Change-Id: Ie758f2fa8068c4090b7ce76c73967483441166cd
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468453


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom SPDK FC-NVMe CI <spdk-ci.pdl@broadcom.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 81d6bcd0
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -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;
}