lib/nvmf: add an in_destruct flag to the ctrlr struct
Helps us avoid adding a new I/O qpair while the ctrlr is being destroyed. Signed-off-by: Seth Howell <seth.howell@intel.com> Change-Id: I3bf9318b075125b9d432b885fa9f6f2f44d422d7 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3686 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> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
5a92ce53df
commit
0162da7f76
@ -451,6 +451,13 @@ nvmf_ctrlr_add_io_qpair(void *ctx)
|
||||
*/
|
||||
qpair->ctrlr = NULL;
|
||||
|
||||
/* Make sure the controller is not being destroyed. */
|
||||
if (ctrlr->in_destruct) {
|
||||
SPDK_ERRLOG("Got I/O connect while ctrlr was being destroyed.\n");
|
||||
SPDK_NVMF_INVALID_CONNECT_CMD(rsp, qid);
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (ctrlr->subsys->subtype == SPDK_NVMF_SUBTYPE_DISCOVERY) {
|
||||
SPDK_ERRLOG("I/O connect not allowed on discovery controller\n");
|
||||
SPDK_NVMF_INVALID_CONNECT_CMD(rsp, qid);
|
||||
@ -508,6 +515,14 @@ _nvmf_ctrlr_add_io_qpair(void *ctx)
|
||||
return;
|
||||
}
|
||||
|
||||
/* fail before passing a message to the controller thread. */
|
||||
if (ctrlr->in_destruct) {
|
||||
SPDK_ERRLOG("Got I/O connect while ctrlr was being destroyed.\n");
|
||||
SPDK_NVMF_INVALID_CONNECT_CMD(rsp, qid);
|
||||
spdk_nvmf_request_complete(req);
|
||||
return;
|
||||
}
|
||||
|
||||
admin_qpair = ctrlr->admin_qpair;
|
||||
qpair->ctrlr = ctrlr;
|
||||
spdk_thread_send_msg(admin_qpair->group->thread, nvmf_ctrlr_add_io_qpair, req);
|
||||
|
@ -866,6 +866,7 @@ _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) {
|
||||
ctrlr->in_destruct = true;
|
||||
spdk_thread_send_msg(ctrlr->subsys->thread, _nvmf_ctrlr_destruct, ctrlr);
|
||||
}
|
||||
|
||||
|
@ -234,6 +234,7 @@ struct spdk_nvmf_ctrlr {
|
||||
struct spdk_poller *association_timer;
|
||||
|
||||
bool dif_insert_or_strip;
|
||||
bool in_destruct;
|
||||
|
||||
TAILQ_ENTRY(spdk_nvmf_ctrlr) link;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user