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 <seth.howell@intel.com>
Change-Id: I0c0199c8392ee278f36df56f599beb10e7a46948
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3685
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Seth Howell 2020-08-06 18:00:17 -07:00 committed by Tomasz Zawadzki
parent f803df5129
commit d156d2f771
2 changed files with 1 additions and 3 deletions

View File

@ -403,7 +403,7 @@ _nvmf_ctrlr_destruct(void *ctx)
struct spdk_nvmf_reservation_log *log, *log_tmp; struct spdk_nvmf_reservation_log *log, *log_tmp;
nvmf_ctrlr_stop_keep_alive_timer(ctrlr); 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_FOREACH_SAFE(log, &ctrlr->log_head, link, log_tmp) {
TAILQ_REMOVE(&ctrlr->log_head, log, link); TAILQ_REMOVE(&ctrlr->log_head, log, link);
free(log); free(log);

View File

@ -866,8 +866,6 @@ _nvmf_ctrlr_free_from_qpair(void *ctx)
spdk_bit_array_clear(ctrlr->qpair_mask, qpair_ctx->qid); spdk_bit_array_clear(ctrlr->qpair_mask, qpair_ctx->qid);
count = spdk_bit_array_count_set(ctrlr->qpair_mask); count = spdk_bit_array_count_set(ctrlr->qpair_mask);
if (count == 0) { if (count == 0) {
spdk_bit_array_free(&ctrlr->qpair_mask);
spdk_thread_send_msg(ctrlr->subsys->thread, _nvmf_ctrlr_destruct, ctrlr); spdk_thread_send_msg(ctrlr->subsys->thread, _nvmf_ctrlr_destruct, ctrlr);
} }