Commit f1fabd08 authored by kyuho.son's avatar kyuho.son Committed by Tomasz Zawadzki
Browse files

nvmf: nvmf_ctx_stop_mdns_prr call directly stops avahi service and destroys its context



Previously, destroying Avahi contexts took time when nvmf_stop_mdns_prr is invoked. If the process
is terminated before the Avahi contexts are fully destroyed, an ASAN error may occur.
To prevent this error, nvmf_ctx_stop_mdns_prr directly unregister poller and destroy avahi contexts.

Fixes #3407

Change-Id: I1cdfc902b56264acb7a647ce99188c7101038e34
Signed-off-by: default avatarkyuho.son <kyuho.son@samsung.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23725


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 6121d38e
Loading
Loading
Loading
Loading
+3 −9
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ static AvahiClient *g_avahi_publish_client = NULL;
static AvahiEntryGroup *g_avahi_entry_group = NULL;

struct mdns_publish_ctx {
	bool				stop;
	struct spdk_poller		*poller;
	struct spdk_nvmf_subsystem	*subsystem;
	struct spdk_nvmf_tgt		*tgt;
@@ -69,13 +68,6 @@ nvmf_avahi_publish_iterate(void *arg)
		return SPDK_POLLER_IDLE;
	}

	if (ctx->stop) {
		SPDK_INFOLOG(nvmf, "Stopping avahi publish poller\n");
		spdk_poller_unregister(&ctx->poller);
		nvmf_avahi_publish_destroy(ctx);
		return SPDK_POLLER_BUSY;
	}

	rc = avahi_simple_poll_iterate(g_avahi_publish_simple_poll, 0);
	if (rc && rc != -EAGAIN) {
		SPDK_ERRLOG("avahi publish poll returned error\n");
@@ -90,7 +82,9 @@ nvmf_avahi_publish_iterate(void *arg)
static void
nvmf_ctx_stop_mdns_prr(struct mdns_publish_ctx *ctx)
{
	ctx->stop = true;
	SPDK_INFOLOG(nvmf, "Stopping avahi publish poller\n");
	spdk_poller_unregister(&ctx->poller);
	nvmf_avahi_publish_destroy(ctx);
}

void