nvme_tcp: Use qpair->poll_group only if it is not NULL

nvme_transport_poll_group_remove() clears qpair->poll_group. Hence
we should not use it after that.

Fixes #2170

Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Change-Id: I57ceee8c66684e2d02b51b8a0f3d66aacbcb9915
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9560
Community-CI: Mellanox Build Bot
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Dong Yi <dongx.yi@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2021-09-20 07:06:37 +09:00 committed by Tomasz Zawadzki
parent d42557401c
commit c9ab7ae4b3

View File

@ -383,7 +383,7 @@ _pdu_write_done(void *cb_arg, int err)
{
struct nvme_tcp_pdu *pdu = cb_arg;
struct nvme_tcp_qpair *tqpair = pdu->qpair;
struct nvme_tcp_poll_group *pgroup = nvme_tcp_poll_group(tqpair->qpair.poll_group);
struct nvme_tcp_poll_group *pgroup;
/* If there are queued requests, we assume they are queued because they are waiting
* for resources to be released. Those resources are almost certainly released in
@ -391,7 +391,10 @@ _pdu_write_done(void *cb_arg, int err)
* the qpair needs to be polled and we can't rely on another network event to make
* that happen. Add it to a list of qpairs to poll regardless of network activity
* here. */
if (pgroup && !STAILQ_EMPTY(&tqpair->qpair.queued_req) && !tqpair->needs_poll) {
if (tqpair->qpair.poll_group && !STAILQ_EMPTY(&tqpair->qpair.queued_req) &&
!tqpair->needs_poll) {
pgroup = nvme_tcp_poll_group(tqpair->qpair.poll_group);
TAILQ_INSERT_TAIL(&pgroup->needs_poll, tqpair, link);
tqpair->needs_poll = true;
}
@ -1073,7 +1076,7 @@ tcp_data_recv_crc32_done(void *cb_arg, int status)
tqpair = tcp_req->tqpair;
assert(tqpair != NULL);
if (!tqpair->needs_poll) {
if (tqpair->qpair.poll_group && !tqpair->needs_poll) {
pgroup = nvme_tcp_poll_group(tqpair->qpair.poll_group);
TAILQ_INSERT_TAIL(&pgroup->needs_poll, tqpair, link);
tqpair->needs_poll = true;