From 2255533973f32418b27c8a9c1853a518baa97bff Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 15 Jun 2018 03:49:56 -0700 Subject: [PATCH] bdev: remove shared_resource from TAILQ before putting io channel Normally, the put_io_channel is deferred - but for unit tests messages are called inline and not as events. This results in spdk_bdev_mgmt_channel_destroy() complaining that the shared_resource list isn't empty. So just remove it from the TAILQ before putting the io_channel - that's more correct anyways. Signed-off-by: Jim Harris Change-Id: Ifd3418f208c906ac09822cb9202068baf0fe211a Reviewed-on: https://review.gerrithub.io/415529 Tested-by: SPDK Automated Test System Reviewed-by: Ben Walker Reviewed-by: Daniel Verkamp --- lib/bdev/bdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bdev/bdev.c b/lib/bdev/bdev.c index e6d974eaf..324ea640c 100644 --- a/lib/bdev/bdev.c +++ b/lib/bdev/bdev.c @@ -1172,8 +1172,8 @@ _spdk_bdev_channel_destroy_resource(struct spdk_bdev_channel *ch) shared_resource->ref--; if (shared_resource->ref == 0) { assert(shared_resource->io_outstanding == 0); - spdk_put_io_channel(spdk_io_channel_from_ctx(shared_resource->mgmt_ch)); TAILQ_REMOVE(&shared_resource->mgmt_ch->shared_resources, shared_resource, link); + spdk_put_io_channel(spdk_io_channel_from_ctx(shared_resource->mgmt_ch)); free(shared_resource); } }