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 <james.r.harris@intel.com>
Change-Id: I909a409f34c7783a32d3300942897f591c90fca1

Reviewed-on: https://review.gerrithub.io/433201
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2018-10-30 23:14:32 -07:00
parent 8c50e8c106
commit c6d403e92d

View File

@ -220,6 +220,7 @@ void
spdk_free_thread(void) spdk_free_thread(void)
{ {
struct spdk_thread *thread; struct spdk_thread *thread;
struct spdk_io_channel *ch;
pthread_mutex_lock(&g_devlist_mutex); 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); 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); assert(g_thread_count > 0);
g_thread_count--; g_thread_count--;
TAILQ_REMOVE(&g_threads, thread, tailq); TAILQ_REMOVE(&g_threads, thread, tailq);