Commit 7afb03f0 authored by Kaiqi Chen's avatar Kaiqi Chen Committed by Tomasz Zawadzki
Browse files

Revert "lib/nvmf: Defer port removal while qpairs exist in poll group"



This reverts commit 4045068a.

Commit 4045068a requires that a listener must not stop until all qpairs
are destroyed, in order to prevent qpairs from accessing a freed
listen_id after the listener stops. However, if there are many inflight
IOs on the qpairs and these IOs take a long time to complete, stopping
the listener will be significantly delayed.

Commit 244a1be5a has already addressed this issue by saving the
listen_trid within each spdk_nvmf_rdma_qpair, allowing qpairs to
retain the necessary information without depending on the lifetime of
listen_id. This enables safe listener cleanup without delay, while still
ensuring memory safety.

Change-Id: Iabde285184377657addfe41ceeebea7bc41e52bc
Signed-off-by: default avatarKaiqi Chen <kaiqi.chen@smartx.com>
Reviewed-on: https://review.spdk.io/c/spdk/spdk/+/26352


Reviewed-by: default avatarJim Harris <jim.harris@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK Automated Test System <spdkbot@gmail.com>
Reviewed-by: default avatarChangpeng Liu <changpeliu@tencent.com>
parent 34479d74
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -502,14 +502,6 @@ nvmf_stop_listen_fini(struct spdk_io_channel_iter *i, int status)
	free(ctx);
}

static void nvmf_stop_listen_disconnect_qpairs(struct spdk_io_channel_iter *i);

static void
nvmf_stop_listen_disconnect_qpairs_msg(void *ctx)
{
	nvmf_stop_listen_disconnect_qpairs((struct spdk_io_channel_iter *)ctx);
}

static void
nvmf_stop_listen_disconnect_qpairs(struct spdk_io_channel_iter *i)
{
@@ -518,7 +510,6 @@ nvmf_stop_listen_disconnect_qpairs(struct spdk_io_channel_iter *i)
	struct spdk_io_channel *ch;
	struct spdk_nvmf_qpair *qpair, *tmp_qpair;
	struct spdk_nvme_transport_id tmp_trid;
	bool qpair_found = false;

	ctx = spdk_io_channel_iter_get_ctx(i);
	ch = spdk_io_channel_iter_get_channel(i);
@@ -536,15 +527,9 @@ nvmf_stop_listen_disconnect_qpairs(struct spdk_io_channel_iter *i)
			if (ctx->subsystem == NULL ||
			    (qpair->ctrlr != NULL && ctx->subsystem == qpair->ctrlr->subsys)) {
				spdk_nvmf_qpair_disconnect(qpair);
				qpair_found = true;
			}
			}
		}
	if (qpair_found) {
		spdk_thread_send_msg(spdk_get_thread(), nvmf_stop_listen_disconnect_qpairs_msg, i);
		return;
	}

	spdk_for_each_channel_continue(i, 0);
}