nvmf: Stop all listeners when destroying transport

When subsystem is destroyed, it removes its listeners,
however transport level listeners remain active.
This patch removes all transport listerners when
the transport is being destroyed.

Fixes issue 2353/

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: Ica7bcb0052b626aa62d0da9049bb8f216027dc49
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11307
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
Alexey Marchuk 2022-01-27 15:38:20 +03:00 committed by Tomasz Zawadzki
parent c708e6dfdb
commit 29d94b7f01

View File

@ -284,6 +284,8 @@ int
spdk_nvmf_transport_destroy(struct spdk_nvmf_transport *transport,
spdk_nvmf_transport_destroy_done_cb cb_fn, void *cb_arg)
{
struct spdk_nvmf_listener *listener, *listener_tmp;
if (transport->data_buf_pool != NULL) {
if (spdk_mempool_count(transport->data_buf_pool) !=
transport->opts.num_shared_buffers) {
@ -294,6 +296,12 @@ spdk_nvmf_transport_destroy(struct spdk_nvmf_transport *transport,
spdk_mempool_free(transport->data_buf_pool);
}
TAILQ_FOREACH_SAFE(listener, &transport->listeners, link, listener_tmp) {
TAILQ_REMOVE(&transport->listeners, listener, link);
transport->ops->stop_listen(transport, &listener->trid);
free(listener);
}
return transport->ops->destroy(transport, cb_fn, cb_arg);
}