nvmf: make each io qpair recycled by its own thread

This patch selects part of commit:
adfa9f6dc7

In the previous patch, the failed reason is the logic
that admin qpair actively destroys the ioqpair when
the admin qpair is recevied early. For this part,
we need to investigate it later since for multiple core
usage in our current handling case, we possibly have
admin qpair firstly to enter the destruct phase even if
the initiator sends the I/O qpair deletion first. Thus,
the ioqpair deletion can be recycled twice.

And this patch is selecting the part of the logic:
only to make each ioqpair recycled by its own thread.

Change-Id: Ic9cc3fbdf56fa8a75cb5d12a16ce6c3129220bca
Signed-off-by: Ziye Yang <optimistyzy@gmail.com>
Reviewed-on: https://review.gerrithub.io/409363
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Ziye Yang 2018-04-28 08:53:55 +08:00 committed by Daniel Verkamp
parent 86ee572b79
commit cbbec6dd16

View File

@ -274,6 +274,32 @@ end:
spdk_thread_send_msg(qpair->group->thread, _spdk_nvmf_request_complete, req);
}
static void
_ctrlr_destruct_check(void *ctx)
{
struct spdk_nvmf_ctrlr *ctrlr = ctx;
assert(ctrlr != NULL);
assert(ctrlr->num_qpairs > 0);
ctrlr->num_qpairs--;
if (ctrlr->num_qpairs == 0) {
assert(ctrlr->subsys != NULL);
assert(ctrlr->subsys->thread != NULL);
spdk_thread_send_msg(ctrlr->subsys->thread, ctrlr_destruct, ctrlr);
}
}
static void
nvmf_qpair_fini(void *ctx)
{
struct spdk_nvmf_qpair *qpair = ctx;
struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr;
struct spdk_thread *admin_thread = ctrlr->admin_qpair->group->thread;
spdk_nvmf_transport_qpair_fini(qpair);
spdk_thread_send_msg(admin_thread, _ctrlr_destruct_check, ctrlr);
}
static void
ctrlr_delete_qpair(void *ctx)
{
@ -288,15 +314,8 @@ ctrlr_delete_qpair(void *ctx)
return;
}
ctrlr->num_qpairs--;
TAILQ_REMOVE(&ctrlr->qpairs, qpair, link);
spdk_nvmf_transport_qpair_fini(qpair);
if (ctrlr->num_qpairs == 0) {
assert(ctrlr->subsys != NULL);
assert(ctrlr->subsys->thread != NULL);
spdk_thread_send_msg(ctrlr->subsys->thread, ctrlr_destruct, ctrlr);
}
spdk_thread_send_msg(qpair->group->thread, nvmf_qpair_fini, qpair);
}
static void