nvmf/rpc: Put channel refcount after nvmf_subsystem_get_qpairs use

nvmf_subsystem_get_qpairs RPC handler may cause the program
could not exit normally (e.g. ctrl c). Reason is that,
spdk_get_io_channel() will be called during the getting
qpairs stream, which will add refcount value for each
existing channel. When end target, channel cannot be
destroyed since refcount be added additionally and
its value could not be subtracted to 0. As a result,
the program will hang in the process of exiting.

So here we don't need to allocate a new channel, just use
the exist one.

Signed-off-by: zhaoshushu.zss <zhaoshushu.zss@alibaba-inc.com>
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Change-Id: I08b4678edaa9404b8e8af125ebae572b31edf77e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9881
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
zhaoshushu.zss 2021-10-12 17:39:45 -04:00 committed by Tomasz Zawadzki
parent ce7a40b6ee
commit 6000920e8c

View File

@ -2342,7 +2342,7 @@ rpc_nvmf_get_qpairs(struct spdk_io_channel_iter *i)
struct spdk_nvmf_poll_group *group;
struct spdk_nvmf_qpair *qpair;
ch = spdk_get_io_channel(ctx->subsystem->tgt);
ch = spdk_io_channel_iter_get_channel(i);
group = spdk_io_channel_get_ctx(ch);
TAILQ_FOREACH(qpair, &group->qpairs, link) {