From c1e0bded59d7f9d3d76a95987a4990cc49c9a127 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Tue, 5 Feb 2019 13:01:25 -0700 Subject: [PATCH] nvmf_tgt: read ret from spdk_nvmf_poll_group_add. It is possible for spdk_nvmf_poll_group_add to fail. In this case we need to tear down the qpair in the same way that we do in the new_qpair function. Change-Id: I17abdec2646d2b7f9ed07c9b9b3e74d3d0991903 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/443472 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- lib/event/subsystems/nvmf/nvmf_tgt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/event/subsystems/nvmf/nvmf_tgt.c b/lib/event/subsystems/nvmf/nvmf_tgt.c index bb35dcce5..663e77ef4 100644 --- a/lib/event/subsystems/nvmf/nvmf_tgt.c +++ b/lib/event/subsystems/nvmf/nvmf_tgt.c @@ -119,7 +119,10 @@ nvmf_tgt_poll_group_add(void *arg1, void *arg2) struct spdk_nvmf_qpair *qpair = arg1; struct nvmf_tgt_poll_group *pg = arg2; - spdk_nvmf_poll_group_add(pg->group, qpair); + if (spdk_nvmf_poll_group_add(pg->group, qpair) != 0) { + SPDK_ERRLOG("Unable to add the qpair to a poll group.\n"); + spdk_nvmf_qpair_disconnect(qpair, NULL, NULL); + } } /* Round robin selection of cores */