aboutsummaryrefslogtreecommitdiff
path: root/migration
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2023-09-28 15:19:47 +0200
committerJuan Quintela <quintela@redhat.com>2023-10-11 11:17:03 +0200
commitf35c0d9b0773e3ad143eeaf8d7ef3d4ce85a7e7f (patch)
treee8123ad0c0d040f4d0050fe59e09dc84984efee1 /migration
parent142bd685ae10e1354b579a92db02c473f57080f0 (diff)
downloadqemu-f35c0d9b0773e3ad143eeaf8d7ef3d4ce85a7e7f.zip
qemu-f35c0d9b0773e3ad143eeaf8d7ef3d4ce85a7e7f.tar.gz
qemu-f35c0d9b0773e3ad143eeaf8d7ef3d4ce85a7e7f.tar.bz2
migration/rdma: Fix qemu_get_cm_event_timeout() to always set error
qemu_get_cm_event_timeout() neglects to set an error when it fails because rdma_get_cm_event() fails. Harmless, as its caller qemu_rdma_connect() substitutes a generic error then. Fix it anyway. qemu_rdma_connect() also sets the generic error when its own call of rdma_get_cm_event() fails. Make the error handling more obvious: set a specific error right after rdma_get_cm_event() fails. Delete the generic error. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> Reviewed-by: Li Zhijian <lizhijian@fujitsu.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com> Message-ID: <20230928132019.2544702-22-armbru@redhat.com>
Diffstat (limited to 'migration')
-rw-r--r--migration/rdma.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/migration/rdma.c b/migration/rdma.c
index 9c576bd..0039295 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -2555,7 +2555,11 @@ static int qemu_get_cm_event_timeout(RDMAContext *rdma,
ERROR(errp, "failed to poll cm event, errno=%i", errno);
return -1;
} else if (poll_fd.revents & POLLIN) {
- return rdma_get_cm_event(rdma->channel, cm_event);
+ if (rdma_get_cm_event(rdma->channel, cm_event) < 0) {
+ ERROR(errp, "failed to get cm event");
+ return -1;
+ }
+ return 0;
} else {
ERROR(errp, "no POLLIN event, revent=%x", poll_fd.revents);
return -1;
@@ -2605,6 +2609,9 @@ static int qemu_rdma_connect(RDMAContext *rdma, bool return_path,
ret = qemu_get_cm_event_timeout(rdma, &cm_event, 5000, errp);
} else {
ret = rdma_get_cm_event(rdma->channel, &cm_event);
+ if (ret < 0) {
+ ERROR(errp, "failed to get cm event");
+ }
}
if (ret) {
/*
@@ -2613,7 +2620,6 @@ static int qemu_rdma_connect(RDMAContext *rdma, bool return_path,
* Will go away later in this series.
*/
perror("rdma_get_cm_event after rdma_connect");
- ERROR(errp, "connecting to destination!");
goto err_rdma_source_connect;
}