[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 28/65] migration/rdma: Fix qemu_get_cm_event_timeout() to always s
From: |
Juan Quintela |
Subject: |
[PULL 28/65] migration/rdma: Fix qemu_get_cm_event_timeout() to always set error |
Date: |
Wed, 11 Oct 2023 11:21:26 +0200 |
From: Markus Armbruster <armbru@redhat.com>
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>
---
migration/rdma.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 9c576bdcba..0039295a15 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;
}
--
2.41.0
- [PULL 12/65] migration/rdma: Consistently use uint64_t for work request IDs, (continued)
- [PULL 12/65] migration/rdma: Consistently use uint64_t for work request IDs, Juan Quintela, 2023/10/11
- [PULL 11/65] migration/rdma: Drop fragile wr_id formatting, Juan Quintela, 2023/10/11
- [PULL 14/65] migration/rdma: Clean up two more harmless signed vs. unsigned issues, Juan Quintela, 2023/10/11
- [PULL 15/65] migration/rdma: Give qio_channel_rdma_source_funcs internal linkage, Juan Quintela, 2023/10/11
- [PULL 16/65] migration/rdma: Fix qemu_rdma_accept() to return failure on errors, Juan Quintela, 2023/10/11
- [PULL 17/65] migration/rdma: Put @errp parameter last, Juan Quintela, 2023/10/11
- [PULL 18/65] migration/rdma: Eliminate error_propagate(), Juan Quintela, 2023/10/11
- [PULL 19/65] migration/rdma: Drop rdma_add_block() error handling, Juan Quintela, 2023/10/11
- [PULL 20/65] migration/rdma: Drop qemu_rdma_search_ram_block() error handling, Juan Quintela, 2023/10/11
- [PULL 21/65] migration/rdma: Make qemu_rdma_buffer_mergeable() return bool, Juan Quintela, 2023/10/11
- [PULL 28/65] migration/rdma: Fix qemu_get_cm_event_timeout() to always set error,
Juan Quintela <=
- [PULL 23/65] migration/rdma: Fix or document problematic uses of errno, Juan Quintela, 2023/10/11
- [PULL 24/65] migration/rdma: Ditch useless numeric error codes in error messages, Juan Quintela, 2023/10/11
- [PULL 31/65] migration/rdma: Fix rdma_getaddrinfo() error checking, Juan Quintela, 2023/10/11
- [PULL 34/65] migration/rdma: Replace int error_state by bool errored, Juan Quintela, 2023/10/11
- [PULL 33/65] migration/rdma: Dumb down remaining int error values to -1, Juan Quintela, 2023/10/11
- [PULL 22/65] migration/rdma: Use bool for two RDMAContext flags, Juan Quintela, 2023/10/11
- [PULL 25/65] migration/rdma: Fix io_writev(), io_readv() methods to obey contract, Juan Quintela, 2023/10/11
- [PULL 29/65] migration/rdma: Drop dead qemu_rdma_data_init() code for !@host_port, Juan Quintela, 2023/10/11
- [PULL 30/65] migration/rdma: Fix QEMUFileHooks method return values, Juan Quintela, 2023/10/11
- [PULL 26/65] migration/rdma: Replace dangerous macro CHECK_ERROR_STATE(), Juan Quintela, 2023/10/11