Commit 1e2c9afa authored by Seth Howell's avatar Seth Howell Committed by Jim Harris
Browse files

nvmf: always call qpair_delete cb on original thread



This ensures that when we continue to iterate through channels after
deleting the qpair, we will be able to continue iterating through
channels.

Change-Id: I6fba43dc14a3e5e8faac78f8b37e9e0c6aad2687
Signed-off-by: default avatarSeth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/419920


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarZiye Yang <optimistyzy@gmail.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 4bee4e03
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -60,6 +60,7 @@ struct nvmf_qpair_disconnect_ctx {
	struct spdk_nvmf_qpair *qpair;
	struct spdk_nvmf_ctrlr *ctrlr;
	nvmf_qpair_disconnect_cb cb_fn;
	struct spdk_thread *thread;
	void *ctx;
};

@@ -616,7 +617,7 @@ _spdk_nvmf_ctrlr_free_from_qpair(void *ctx)
	spdk_nvmf_ctrlr_destruct(ctrlr);

	if (qpair_ctx->cb_fn) {
		qpair_ctx->cb_fn(qpair_ctx->ctx);
		spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx);
	}
	free(qpair_ctx);
}
@@ -639,7 +640,7 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status)

	if (!ctrlr) {
		if (qpair_ctx->cb_fn) {
			qpair_ctx->cb_fn(qpair_ctx->ctx);
			spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx);
		}
		free(qpair_ctx);
		return;
@@ -657,7 +658,7 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status)
		spdk_thread_send_msg(ctrlr->subsys->thread, _spdk_nvmf_ctrlr_free_from_qpair, qpair_ctx);
	} else {
		if (qpair_ctx->cb_fn) {
			qpair_ctx->cb_fn(qpair_ctx->ctx);
			spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx);
		}
		free(qpair_ctx);
	}
@@ -675,7 +676,7 @@ _spdk_nvmf_qpair_deactivate(void *ctx)
		 * which results in a notification that the connection
		 * died. */
		if (qpair_ctx->cb_fn) {
			qpair_ctx->cb_fn(qpair_ctx->ctx);
			spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx);
		}
		free(qpair_ctx);
		return;
@@ -707,6 +708,7 @@ spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_

	qpair_ctx->qpair = qpair;
	qpair_ctx->cb_fn = cb_fn;
	qpair_ctx->thread = qpair->group->thread;
	qpair_ctx->ctx = ctx;

	if (qpair->group->thread == spdk_get_thread()) {