Commit 6000920e authored by zhaoshushu.zss's avatar zhaoshushu.zss Committed by Tomasz Zawadzki
Browse files

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: default avatarzhaoshushu.zss <zhaoshushu.zss@alibaba-inc.com>
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Change-Id: I08b4678edaa9404b8e8af125ebae572b31edf77e
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9881


Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent ce7a40b6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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) {