From c6d403e92da197085072714045cbe32e2704ddb5 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Tue, 30 Oct 2018 23:14:32 -0700 Subject: [PATCH] thread: print error if channels exist on thread free Eventually we may want to assert if any channels still exist when the thread is freed, but for now we'll just stick with the error message. Signed-off-by: Jim Harris Change-Id: I909a409f34c7783a32d3300942897f591c90fca1 Reviewed-on: https://review.gerrithub.io/433201 Chandler-Test-Pool: SPDK Automated Test System Reviewed-by: Darek Stojaczyk Reviewed-by: Changpeng Liu Reviewed-by: Paul Luse Reviewed-by: Ben Walker Tested-by: SPDK CI Jenkins --- lib/thread/thread.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/thread/thread.c b/lib/thread/thread.c index a68d286b7..11cc19670 100644 --- a/lib/thread/thread.c +++ b/lib/thread/thread.c @@ -220,6 +220,7 @@ void spdk_free_thread(void) { struct spdk_thread *thread; + struct spdk_io_channel *ch; pthread_mutex_lock(&g_devlist_mutex); @@ -232,6 +233,11 @@ spdk_free_thread(void) SPDK_DEBUGLOG(SPDK_LOG_THREAD, "Freeing thread %s\n", thread->name); + TAILQ_FOREACH(ch, &thread->io_channels, tailq) { + SPDK_ERRLOG("thread %s still has channel for io_device %s\n", + thread->name, ch->dev->name); + } + assert(g_thread_count > 0); g_thread_count--; TAILQ_REMOVE(&g_threads, thread, tailq);