From 26d4436a526c7eafc7416b28daa761c08be19ef8 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 25 Feb 2022 01:52:41 +0000 Subject: [PATCH] bdev/nvme: rename discovery_ctx->detach to ->stop Detach and stop are two different operations. This ->detach field was used to denote when the associated discovery service should be stopped. So call the field 'stop' instead. That may trigger the currently attached discovery controller to be detached. Signed-off-by: Jim Harris Change-Id: I61c7fc860cd9dbcfab71eedfd223c06c51a41f27 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11771 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Shuhei Matsumoto --- module/bdev/nvme/bdev_nvme.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/module/bdev/nvme/bdev_nvme.c b/module/bdev/nvme/bdev_nvme.c index 1a6508601..9bfd30745 100644 --- a/module/bdev/nvme/bdev_nvme.c +++ b/module/bdev/nvme/bdev_nvme.c @@ -4350,10 +4350,11 @@ struct discovery_ctx { */ bool pending; - /* Signal to the discovery context poller that it should detach from - * the discovery controller. + /* Signal to the discovery context poller that it should stop the + * discovery service, including detaching from the current discovery + * controller. */ - bool detach; + bool stop; struct spdk_thread *calling_thread; uint32_t index; @@ -4643,7 +4644,7 @@ discovery_poller(void *arg) struct spdk_nvme_transport_id *trid; int rc; - if (ctx->detach) { + if (ctx->stop) { bool detach_done = false; if (ctx->ctrlr == NULL) { @@ -4751,10 +4752,10 @@ bdev_nvme_stop_discovery(const char *name, spdk_bdev_nvme_stop_discovery_fn cb_f TAILQ_FOREACH(ctx, &g_discovery_ctxs, tailq) { if (strcmp(name, ctx->name) == 0) { - if (ctx->detach) { + if (ctx->stop) { return -EALREADY; } - ctx->detach = true; + ctx->stop = true; ctx->stop_cb_fn = cb_fn; ctx->cb_ctx = cb_ctx; while (!TAILQ_EMPTY(&ctx->nvm_entry_ctxs)) { @@ -4857,7 +4858,7 @@ bdev_nvme_library_fini(void) bdev_nvme_fini_destruct_ctrlrs(); } else { TAILQ_FOREACH(ctx, &g_discovery_ctxs, tailq) { - ctx->detach = true; + ctx->stop = true; ctx->stop_cb_fn = check_discovery_fini; } }