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 <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/c/441611
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
Seth Howell 2019-01-22 15:47:55 -07:00 committed by Ben Walker
parent 7c233adeff
commit 4620386417

View File

@ -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;