lib/nvmf: complete requests in req_process for inactive qpairs.

There is no reason to continue processing these requests if the
qpair is not still active. We should complete them and free
any resources they are still holding.

Also, not doing so can cause issues with trying to access pointers
in the qpair after they are invalid. See issue #1460.

Signed-off-by: Seth Howell <seth.howell@intel.com>
Change-Id: I6e570a576983dfedf726dc4a9a83316209403e00
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/3451
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
This commit is contained in:
Seth Howell 2020-07-20 15:04:10 -07:00 committed by Tomasz Zawadzki
parent 2d877401fd
commit f0be991330
2 changed files with 9 additions and 0 deletions

View File

@ -2088,6 +2088,14 @@ nvmf_tcp_req_process(struct spdk_nvmf_tcp_transport *ttransport,
group = &tqpair->group->group;
assert(tcp_req->state != TCP_REQUEST_STATE_FREE);
/* If the qpair is not active, we need to abort the outstanding requests. */
if (tqpair->qpair.state != SPDK_NVMF_QPAIR_ACTIVE) {
if (tcp_req->state == TCP_REQUEST_STATE_NEED_BUFFER) {
STAILQ_REMOVE(&group->pending_buf_queue, &tcp_req->req, spdk_nvmf_request, buf_link);
}
nvmf_tcp_req_set_state(tcp_req, TCP_REQUEST_STATE_COMPLETED);
}
/* The loop here is to allow for several back-to-back state changes. */
do {
prev_state = tcp_req->state;

View File

@ -644,6 +644,7 @@ test_nvmf_tcp_incapsule_data_handle(void)
tqpair.qpair.transport = &ttransport.transport;
tqpair.state = NVME_TCP_QPAIR_STATE_RUNNING;
tqpair.recv_state = NVME_TCP_PDU_RECV_STATE_AWAIT_PDU_PSH;
tqpair.qpair.state = SPDK_NVMF_QPAIR_ACTIVE;
/* init a null tcp_req into tqpair TCP_REQUEST_STATE_FREE queue */
tcp_req2.req.qpair = &tqpair.qpair;