Commit b0171f79 authored by Seth Howell's avatar Seth Howell Committed by Ben Walker
Browse files

nvmf_tgt: delete connections accepted during shutdown



With the reordering of the nvmf_tgt states, we need to remove any
connections accepted during the shutdown pahse of the target.

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


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarZiye Yang <optimistyzy@gmail.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
parent 3f6041bc
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -118,6 +118,11 @@ new_qpair(struct spdk_nvmf_qpair *qpair)
	struct nvmf_tgt_poll_group *pg;
	uint32_t core;

	if (g_tgt_state != NVMF_TGT_RUNNING) {
		spdk_nvmf_qpair_disconnect(qpair, NULL, NULL);
		return;
	}

	core = g_tgt_core;
	g_tgt_core = spdk_env_get_next_core(core);
	if (g_tgt_core == UINT32_MAX) {
+10 −1
Original line number Diff line number Diff line
@@ -753,11 +753,20 @@ spdk_nvmf_qpair_disconnect(struct spdk_nvmf_qpair *qpair, nvmf_qpair_disconnect_
		return -ENOMEM;
	}

	/* If we get a qpair in the uninitialized state, we can just destroy it immediately */
	if (qpair->state == SPDK_NVMF_QPAIR_UNINITIALIZED) {
		free(qpair_ctx);
		spdk_nvmf_transport_qpair_fini(qpair);
		if (cb_fn) {
			cb_fn(ctx);
		}
		return 0;
	}

	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()) {
		_spdk_nvmf_qpair_deactivate(qpair_ctx);
	} else {
+2 −1
Original line number Diff line number Diff line
@@ -57,7 +57,8 @@ enum spdk_nvmf_subsystem_state {
};

enum spdk_nvmf_qpair_state {
	SPDK_NVMF_QPAIR_INACTIVE = 0,
	SPDK_NVMF_QPAIR_UNINITIALIZED = 0,
	SPDK_NVMF_QPAIR_INACTIVE,
	SPDK_NVMF_QPAIR_ACTIVATING,
	SPDK_NVMF_QPAIR_ACTIVE,
	SPDK_NVMF_QPAIR_DEACTIVATING,