lib/nvmf: call ctrlr_fini after clearing qid from ctrlr bit array.

As soon as we disconnect the qpair, the initiator can submit an
additional request to connect a qpair with the same qid as the
one we connected.

This series is aimed at making sure we don't acknowledge a disconnect
until we have cleared that bit.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I76d9312448a9740911465c146a195996cc567370
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1880
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Seth Howell 2020-04-15 21:58:45 -07:00 committed by Tomasz Zawadzki
parent 9d39be44c5
commit 6f38799b6e

View File

@ -778,6 +778,14 @@ void _nvmf_ctrlr_destruct(void *ctx)
spdk_nvmf_ctrlr_destruct(ctrlr); spdk_nvmf_ctrlr_destruct(ctrlr);
} }
static void
_nvmf_transport_qpair_fini(void *ctx)
{
struct spdk_nvmf_qpair *qpair = ctx;
spdk_nvmf_transport_qpair_fini(qpair);
}
static void static void
_spdk_nvmf_ctrlr_free_from_qpair(void *ctx) _spdk_nvmf_ctrlr_free_from_qpair(void *ctx)
{ {
@ -793,6 +801,7 @@ _spdk_nvmf_ctrlr_free_from_qpair(void *ctx)
spdk_thread_send_msg(ctrlr->subsys->thread, _nvmf_ctrlr_destruct, ctrlr); spdk_thread_send_msg(ctrlr->subsys->thread, _nvmf_ctrlr_destruct, ctrlr);
} }
spdk_thread_send_msg(qpair_ctx->thread, _nvmf_transport_qpair_fini, qpair_ctx->qpair);
if (qpair_ctx->cb_fn) { if (qpair_ctx->cb_fn) {
spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx); spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx);
} }
@ -840,9 +849,8 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status)
TAILQ_REMOVE(&qpair->group->qpairs, qpair, link); TAILQ_REMOVE(&qpair->group->qpairs, qpair, link);
spdk_nvmf_transport_qpair_fini(qpair);
if (!ctrlr || !ctrlr->thread) { if (!ctrlr || !ctrlr->thread) {
spdk_nvmf_transport_qpair_fini(qpair);
if (qpair_ctx->cb_fn) { if (qpair_ctx->cb_fn) {
spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx); spdk_thread_send_msg(qpair_ctx->thread, qpair_ctx->cb_fn, qpair_ctx->ctx);
} }