nvme_tcp: Check return value of spdk_sock_group_poll

This function may return an error and we should handle it

Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com>
Change-Id: I996ceb6e300bd9527385aded9068b2841e94a20d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9278
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Alexey Marchuk 2021-08-24 14:52:28 +03:00 committed by Tomasz Zawadzki
parent 75f1d6484a
commit 7d589976f2

View File

@ -2271,11 +2271,12 @@ nvme_tcp_poll_group_process_completions(struct spdk_nvme_transport_poll_group *t
struct nvme_tcp_poll_group *group = nvme_tcp_poll_group(tgroup);
struct spdk_nvme_qpair *qpair, *tmp_qpair;
struct nvme_tcp_qpair *tqpair, *tmp_tqpair;
int num_events;
group->completions_per_qpair = completions_per_qpair;
group->num_completions = 0;
spdk_sock_group_poll(group->sock_group);
num_events = spdk_sock_group_poll(group->sock_group);
STAILQ_FOREACH_SAFE(qpair, &tgroup->disconnected_qpairs, poll_group_stailq, tmp_qpair) {
disconnected_qpair_cb(qpair, tgroup->group->ctx);
@ -2287,6 +2288,10 @@ nvme_tcp_poll_group_process_completions(struct spdk_nvme_transport_poll_group *t
nvme_tcp_qpair_sock_cb(&tqpair->qpair, group->sock_group, tqpair->sock);
}
if (spdk_unlikely(num_events < 0)) {
return num_events;
}
return group->num_completions;
}