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: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/420681
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Ziye Yang <optimistyzy@gmail.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Seth Howell 2018-07-27 12:21:00 -07:00 committed by Ben Walker
parent 3f6041bce4
commit b0171f79c3
3 changed files with 17 additions and 2 deletions

View File

@ -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) {

View File

@ -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 {

View File

@ -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,