nvmf: add qpair->connect_received
Currently we use qpair->ctrlr at qpair destroy time to decide if we need to decrement the qpair's poll group's qpair count. But this is not correct - these counters get incremented when the CONNECT is received, but qpair->ctrlr doesn't get set until later. So add a new connect_received bool to the spdk_nvmf_qpair. Use this instead to determine when we should decrement the poll group qpair counters. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I174a0fda36c4558171953bf58f2f5117bc074f76 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15692 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
This commit is contained in:
parent
478c0fa852
commit
f3e197ff18
@ -123,6 +123,7 @@ struct spdk_nvmf_qpair {
|
|||||||
uint16_t qid;
|
uint16_t qid;
|
||||||
uint16_t sq_head;
|
uint16_t sq_head;
|
||||||
uint16_t sq_head_max;
|
uint16_t sq_head_max;
|
||||||
|
bool connect_received;
|
||||||
bool disconnect_started;
|
bool disconnect_started;
|
||||||
|
|
||||||
struct spdk_nvmf_request *first_fused_req;
|
struct spdk_nvmf_request *first_fused_req;
|
||||||
|
@ -727,6 +727,7 @@ _nvmf_ctrlr_connect(struct spdk_nvmf_request *req)
|
|||||||
|
|
||||||
qpair->sq_head_max = cmd->sqsize;
|
qpair->sq_head_max = cmd->sqsize;
|
||||||
qpair->qid = cmd->qid;
|
qpair->qid = cmd->qid;
|
||||||
|
qpair->connect_received = true;
|
||||||
|
|
||||||
if (0 == qpair->qid) {
|
if (0 == qpair->qid) {
|
||||||
qpair->group->stat.admin_qpairs++;
|
qpair->group->stat.admin_qpairs++;
|
||||||
|
@ -1046,7 +1046,7 @@ _nvmf_qpair_destroy(void *ctx, int status)
|
|||||||
assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING);
|
assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING);
|
||||||
qpair_ctx->qid = qpair->qid;
|
qpair_ctx->qid = qpair->qid;
|
||||||
|
|
||||||
if (ctrlr) {
|
if (qpair->connect_received) {
|
||||||
if (0 == qpair->qid) {
|
if (0 == qpair->qid) {
|
||||||
assert(qpair->group->stat.current_admin_qpairs > 0);
|
assert(qpair->group->stat.current_admin_qpairs > 0);
|
||||||
qpair->group->stat.current_admin_qpairs--;
|
qpair->group->stat.current_admin_qpairs--;
|
||||||
@ -1054,7 +1054,9 @@ _nvmf_qpair_destroy(void *ctx, int status)
|
|||||||
assert(qpair->group->stat.current_io_qpairs > 0);
|
assert(qpair->group->stat.current_io_qpairs > 0);
|
||||||
qpair->group->stat.current_io_qpairs--;
|
qpair->group->stat.current_io_qpairs--;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctrlr) {
|
||||||
sgroup = &qpair->group->sgroups[ctrlr->subsys->id];
|
sgroup = &qpair->group->sgroups[ctrlr->subsys->id];
|
||||||
TAILQ_FOREACH_SAFE(req, &sgroup->queued, link, tmp) {
|
TAILQ_FOREACH_SAFE(req, &sgroup->queued, link, tmp) {
|
||||||
if (req->qpair == qpair) {
|
if (req->qpair == qpair) {
|
||||||
|
Loading…
Reference in New Issue
Block a user