Commit 27d47b9a authored by Ziye Yang's avatar Ziye Yang Committed by Changpeng Liu
Browse files

nvmf: make the qpair disconnnect in the right order.



Reason: Initiator sends the qpair deletion in wrong order.
The correct order should be all io qpairs deletion and then
the admin qpair deletion. However, nvme perf does not follow
this since we did not catch ctrlr + c. If we catch ctrlr + c,
we need to use the spdk app framework, or other methods. We should
support this in another patch.

Morever, to prevent the incorrect behavior causing the coredump
of target, we need also consider such case in our NVMe-oF target
design. And this patch, can solve this issue, it will defer the
admin qpair deletion when there are still active io qpairs.

Change-Id: Iec9b88c1d6254f36963c92402ebfe8bd99abaea5
Signed-off-by: default avatarZiye Yang <ziye.yang@intel.com>
Reviewed-on: https://review.gerrithub.io/407771


Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
parent a3f88767
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -281,6 +281,12 @@ ctrlr_delete_qpair(void *ctx)
	struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr;

	assert(ctrlr != NULL);
	assert(ctrlr->num_qpairs > 0);
	/* Defer the admin qpair deletion since there are still io qpairs */
	if ((ctrlr->num_qpairs > 1) && (qpair == ctrlr->admin_qpair)) {
		spdk_thread_send_msg(qpair->group->thread, ctrlr_delete_qpair, qpair);
		return;
	}

	ctrlr->num_qpairs--;
	TAILQ_REMOVE(&ctrlr->qpairs, qpair, link);