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

Reviewed-on: https://review.gerrithub.io/415529
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Jim Harris 2018-06-15 03:49:56 -07:00 committed by Daniel Verkamp
parent 7699cdeed4
commit 2255533973

View File

@ -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);
}
}