From b0f02769f9f475a05d3873df7ed7ae8f52b48203 Mon Sep 17 00:00:00 2001 From: Changpeng Liu Date: Tue, 8 Feb 2022 20:37:35 +0800 Subject: [PATCH] nvme/fio_plugin: call spdk_env_fini() when exiting the process spdk_fio_cleanup() is called per-thread basis, and spdk_env_fini() is called multiple times when running with `numjobs` greater than 1. Fix issue #2366. Change-Id: I39ec379d71eeba1ca14ba42a93b819220ee1f307 Signed-off-by: Changpeng Liu Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11443 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Tomasz Zawadzki Reviewed-by: Aleksey Marchuk Reviewed-by: Dong Yi Reviewed-by: GangCao --- examples/nvme/fio_plugin/fio_plugin.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/nvme/fio_plugin/fio_plugin.c b/examples/nvme/fio_plugin/fio_plugin.c index e2d8934bbe..cd4a5e6516 100644 --- a/examples/nvme/fio_plugin/fio_plugin.c +++ b/examples/nvme/fio_plugin/fio_plugin.c @@ -1464,10 +1464,6 @@ static void spdk_fio_cleanup(struct thread_data *td) pthread_join(g_ctrlr_thread_id, NULL); } } - - if (g_spdk_env_initialized) { - spdk_env_fini(); - } } /* This function enables addition of SPDK parameters to the fio config @@ -1743,6 +1739,10 @@ static void fio_init fio_spdk_register(void) static void fio_exit fio_spdk_unregister(void) { + if (g_spdk_env_initialized) { + spdk_env_fini(); + } + unregister_ioengine(&ioengine); }