fio_plugin/bdev: Support spdk_threads exiting at run time

Now that the plugin supports SPDK-created spdk_threads, it needs to
handle those threads being removed at run time.

Signed-off-by: Ben Walker <benjamin.walker@intel.com>
Change-Id: I8dee09bf95d1c8fe80f5793ee5476d3f3e1384fd
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11867
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
Ben Walker 2022-03-09 10:34:54 -07:00 committed by Tomasz Zawadzki
parent 0d845de79d
commit 6fb6716d45

View File

@ -359,7 +359,13 @@ spdk_init_thread_poll(void *arg)
pthread_mutex_lock(&g_init_mtx); pthread_mutex_lock(&g_init_mtx);
if (!TAILQ_EMPTY(&g_threads)) { if (!TAILQ_EMPTY(&g_threads)) {
TAILQ_FOREACH_SAFE(thread, &g_threads, link, tmp) { TAILQ_FOREACH_SAFE(thread, &g_threads, link, tmp) {
spdk_fio_poll_thread(thread); if (spdk_thread_is_exited(thread->thread)) {
TAILQ_REMOVE(&g_threads, thread, link);
free(thread->iocq);
spdk_thread_destroy(thread->thread);
} else {
spdk_fio_poll_thread(thread);
}
} }
/* If there are exiting threads to poll, don't sleep. */ /* If there are exiting threads to poll, don't sleep. */