bdev/nvme: handle detach first in discovery_poller

This will be helpful in later patches, when we handle
detach not just at discovery service stop, but also
when a discovery controller is disconnected.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ie62d62f73b328c6e058f6480c61fbdf91e854e2a
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11767
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: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
Jim Harris 2022-02-25 02:00:44 +00:00 committed by Tomasz Zawadzki
parent a96c1bfdbd
commit 43d17a844c

View File

@ -4456,17 +4456,7 @@ discovery_poller(void *arg)
struct discovery_ctx *ctx = arg;
int rc;
if (ctx->probe_ctx) {
rc = spdk_nvme_probe_poll_async(ctx->probe_ctx);
if (rc != -EAGAIN) {
DISCOVERY_DEBUGLOG(ctx, "discovery ctrlr connected\n");
ctx->rc = rc;
spdk_thread_send_msg(ctx->calling_thread, start_discovery_done, ctx);
if (rc == 0) {
get_discovery_log_page(ctx);
}
}
} else if (ctx->detach) {
if (ctx->detach) {
bool detach_done = false;
if (ctx->detach_ctx == NULL) {
@ -4487,6 +4477,16 @@ discovery_poller(void *arg)
ctx->stop_cb_fn(ctx->cb_ctx);
free_discovery_ctx(ctx);
}
} else if (ctx->probe_ctx) {
rc = spdk_nvme_probe_poll_async(ctx->probe_ctx);
if (rc != -EAGAIN) {
DISCOVERY_DEBUGLOG(ctx, "discovery ctrlr connected\n");
ctx->rc = rc;
spdk_thread_send_msg(ctx->calling_thread, start_discovery_done, ctx);
if (rc == 0) {
get_discovery_log_page(ctx);
}
}
} else {
spdk_nvme_ctrlr_process_admin_completions(ctx->ctrlr);
}