thread: assert if io_device_unregister cannot find device

The bdev iscsi initiator had a bug which resulted in
an io_device getting unregistered twice.  An error message
got printed but it didn't immediately result in any kind
of failure detected by any tests.  Really this should be
considered a fatal error, so add an assert() so it's found
more readily should these kinds of bugs occur again in the
future.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I30df86ba2e6a3559e00f054c7dde14713d6ac80f

Reviewed-on: https://review.gerrithub.io/415375
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2018-06-14 11:09:18 -07:00 committed by Daniel Verkamp
parent 2255533973
commit 69679c8033
2 changed files with 1 additions and 1 deletions

View File

@ -388,6 +388,7 @@ spdk_io_device_unregister(void *io_device, spdk_io_device_unregister_cb unregist
if (!dev) {
SPDK_ERRLOG("io_device %p not found\n", io_device);
assert(false);
pthread_mutex_unlock(&g_devlist_mutex);
return;
}

View File

@ -400,7 +400,6 @@ channel(void)
spdk_io_device_unregister(&device1, NULL);
spdk_io_device_unregister(&device2, NULL);
spdk_io_device_unregister(&device3, NULL);
CU_ASSERT(TAILQ_EMPTY(&g_io_devices));
spdk_free_thread();
CU_ASSERT(TAILQ_EMPTY(&g_threads));