bdev/nvme: fix wait_for_attach assignment

Moved assigning ctx->start_cb_fn before it's checked for NULL to set
ctx->wait_for_attach, otherwise it was always false.

Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com>
Change-Id: I819d9e326dbb36f943279c3714695ae604dd64b2
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/12628
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com>
This commit is contained in:
Konrad Sztyber 2022-05-11 13:26:01 +02:00 committed by Tomasz Zawadzki
parent ef675d38c1
commit 5c2b5fc14b

View File

@ -5203,14 +5203,14 @@ bdev_nvme_start_discovery(struct spdk_nvme_transport_id *trid,
memcpy(&ctx->bdev_opts, bdev_opts, sizeof(*bdev_opts)); memcpy(&ctx->bdev_opts, bdev_opts, sizeof(*bdev_opts));
ctx->bdev_opts.from_discovery_service = true; ctx->bdev_opts.from_discovery_service = true;
ctx->calling_thread = spdk_get_thread(); ctx->calling_thread = spdk_get_thread();
ctx->start_cb_fn = cb_fn;
ctx->cb_ctx = cb_ctx;
if (ctx->start_cb_fn) { if (ctx->start_cb_fn) {
/* We can use this when dumping json to denote if this RPC parameter /* We can use this when dumping json to denote if this RPC parameter
* was specified or not. * was specified or not.
*/ */
ctx->wait_for_attach = true; ctx->wait_for_attach = true;
} }
ctx->start_cb_fn = cb_fn;
ctx->cb_ctx = cb_ctx;
TAILQ_INIT(&ctx->nvm_entry_ctxs); TAILQ_INIT(&ctx->nvm_entry_ctxs);
TAILQ_INIT(&ctx->discovery_entry_ctxs); TAILQ_INIT(&ctx->discovery_entry_ctxs);
memcpy(&ctx->trid, trid, sizeof(*trid)); memcpy(&ctx->trid, trid, sizeof(*trid));