From d156d2f7710250bb78e8647d8c9ff77610118ce8 Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Thu, 6 Aug 2020 18:00:17 -0700 Subject: [PATCH] lib/nvmf: don't free ctrlr->qpair_mask early. There are 2 messages passed between when _nvmf_ctrlr_free_from_qpair is executed and when nvmf_ctrlr_destruct is executed. That leaves time when the controller->qpair_mask is not a valid pointer, but it is still in the subsystem controllers list. The purpose of this patch is to close that hole. It is part of a larger series aimed at cleaning up the controller destruct path. Signed-off-by: Seth Howell Change-Id: I0c0199c8392ee278f36df56f599beb10e7a46948 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3685 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Aleksey Marchuk Reviewed-by: Jim Harris --- lib/nvmf/ctrlr.c | 2 +- lib/nvmf/nvmf.c | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/nvmf/ctrlr.c b/lib/nvmf/ctrlr.c index 52f5ed8a0..c11f3ee82 100644 --- a/lib/nvmf/ctrlr.c +++ b/lib/nvmf/ctrlr.c @@ -403,7 +403,7 @@ _nvmf_ctrlr_destruct(void *ctx) struct spdk_nvmf_reservation_log *log, *log_tmp; nvmf_ctrlr_stop_keep_alive_timer(ctrlr); - + spdk_bit_array_free(&ctrlr->qpair_mask); TAILQ_FOREACH_SAFE(log, &ctrlr->log_head, link, log_tmp) { TAILQ_REMOVE(&ctrlr->log_head, log, link); free(log); diff --git a/lib/nvmf/nvmf.c b/lib/nvmf/nvmf.c index 07c506c4c..ed2145533 100644 --- a/lib/nvmf/nvmf.c +++ b/lib/nvmf/nvmf.c @@ -866,8 +866,6 @@ _nvmf_ctrlr_free_from_qpair(void *ctx) spdk_bit_array_clear(ctrlr->qpair_mask, qpair_ctx->qid); count = spdk_bit_array_count_set(ctrlr->qpair_mask); if (count == 0) { - spdk_bit_array_free(&ctrlr->qpair_mask); - spdk_thread_send_msg(ctrlr->subsys->thread, _nvmf_ctrlr_destruct, ctrlr); }