From 4620386417f9dd9358888a7ed324511ea1162a4a Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Tue, 22 Jan 2019 15:47:55 -0700 Subject: [PATCH] nvmf: abort I/O from pg queued list when destroying qp This change was provided by GitHub user vikasbrcm to fix issue 562. I am uploading his change to facilitate testing of the issues and possibly get it merged before the 19.01 window closes. Change-Id: I58fb1058f68c6c02006ceed6e577be627e6dbc09 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/441611 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Changpeng Liu --- lib/nvmf/nvmf.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/nvmf/nvmf.c b/lib/nvmf/nvmf.c index 6b17c05da..eba9add4e 100644 --- a/lib/nvmf/nvmf.c +++ b/lib/nvmf/nvmf.c @@ -706,6 +706,8 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status) struct spdk_nvmf_qpair *qpair = qpair_ctx->qpair; struct spdk_nvmf_ctrlr *ctrlr = qpair->ctrlr; struct spdk_nvmf_transport_poll_group *tgroup; + struct spdk_nvmf_request *req, *tmp; + struct spdk_nvmf_subsystem_poll_group *sgroup; int rc; assert(qpair->state == SPDK_NVMF_QPAIR_DEACTIVATING); @@ -724,6 +726,18 @@ _spdk_nvmf_qpair_destroy(void *ctx, int status) } } + if (ctrlr) { + sgroup = &qpair->group->sgroups[ctrlr->subsys->id]; + TAILQ_FOREACH_SAFE(req, &sgroup->queued, link, tmp) { + if (req->qpair == qpair) { + TAILQ_REMOVE(&sgroup->queued, req, link); + if (spdk_nvmf_transport_req_free(req)) { + SPDK_ERRLOG("Transport request free error!\n"); + } + } + } + } + TAILQ_REMOVE(&qpair->group->qpairs, qpair, link); qpair->group = NULL;