Commit 43d17a84 authored by Jim Harris's avatar Jim Harris Committed by Tomasz Zawadzki
Browse files

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: default avatarJim 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
parent a96c1bfd
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -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);
	}