nvmf/rpc: Fix io channel reference counting in NVMf statistics

NVMf statistics functions use spdk_get_io_channel function to get a
poll group. It increases reference counter in io channel and causes
problems on application exit. spdk_put_io_channel calls were added to
release the channel.

Signed-off-by: Evgeniy Kochetov <evgeniik@mellanox.com>
Change-Id: I832d1eae346c3bc3858ed0ed063ff7a7a897a2f5
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/463389
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Evgeniy Kochetov 2019-07-28 11:36:30 +00:00 committed by Ben Walker
parent dcbe9e42ce
commit c9c80e6932
2 changed files with 2 additions and 0 deletions

View File

@ -1242,5 +1242,6 @@ spdk_nvmf_poll_group_get_stat(struct spdk_nvmf_tgt *tgt,
ch = spdk_get_io_channel(tgt);
group = spdk_io_channel_get_ctx(ch);
*stat = group->stat;
spdk_put_io_channel(ch);
return 0;
}

View File

@ -3698,6 +3698,7 @@ spdk_nvmf_rdma_poll_group_get_stat(struct spdk_nvmf_tgt *tgt,
ch = spdk_get_io_channel(tgt);
group = spdk_io_channel_get_ctx(ch);;
spdk_put_io_channel(ch);
TAILQ_FOREACH(tgroup, &group->tgroups, link) {
if (SPDK_NVME_TRANSPORT_RDMA == tgroup->transport->ops->type) {
*stat = calloc(1, sizeof(struct spdk_nvmf_transport_poll_group_stat));