nvme_rdma: nvme_rdma_process_events() returns negated errno

It will be convenient for the following patches to return
negated errno directly.

Change-Id: Ic80181b2ee449946dd60ad0c97a325fd48b92231
Signed-off-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10990
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Shuhei Matsumoto 2022-01-06 15:42:58 +09:00 committed by Tomasz Zawadzki
parent cf7f253302
commit 791ee7deb4

View File

@ -585,11 +585,10 @@ nvme_rdma_poll_events(struct nvme_rdma_ctrlr *rctrlr)
} }
} }
if (errno == EAGAIN || errno == EWOULDBLOCK) { /* rdma_get_cm_event() returns -1 on error. If an error occurs, errno
return 0; * will be set to indicate the failure reason. So return negated errno here.
} else { */
return errno; return -errno;
}
} }
static int static int
@ -652,11 +651,14 @@ nvme_rdma_process_event(struct nvme_rdma_qpair *rqpair,
rctrlr = nvme_rdma_ctrlr(rqpair->qpair.ctrlr); rctrlr = nvme_rdma_ctrlr(rqpair->qpair.ctrlr);
assert(rctrlr != NULL); assert(rctrlr != NULL);
while (!rqpair->evt && spdk_get_ticks() < timeout_ticks && rc == 0) { while (!rqpair->evt && spdk_get_ticks() < timeout_ticks) {
rc = nvme_rdma_poll_events(rctrlr); rc = nvme_rdma_poll_events(rctrlr);
if (rc == -EAGAIN || rc == -EWOULDBLOCK) {
continue;
}
} }
if (rc) { if (rc != 0 && rc != -EAGAIN && rc != -EWOULDBLOCK) {
goto exit; goto exit;
} }