[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 08/52] migration/rdma: Fix qemu_rdma_accept() to return failure o
From: |
Markus Armbruster |
Subject: |
[PATCH 08/52] migration/rdma: Fix qemu_rdma_accept() to return failure on errors |
Date: |
Mon, 18 Sep 2023 16:41:22 +0200 |
qemu_rdma_accept() returns 0 in some cases even when it didn't
complete its job due to errors. Impact is not obvious. I figure the
caller will soon fail again with a misleading error message.
Fix it to return -1 on any failure.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
migration/rdma.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/migration/rdma.c b/migration/rdma.c
index 177d73a2ba..4339fcc7b2 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -3352,6 +3352,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)
if (cm_event->event != RDMA_CM_EVENT_CONNECT_REQUEST) {
rdma_ack_cm_event(cm_event);
+ ret = -1;
goto err_rdma_dest_wait;
}
@@ -3364,6 +3365,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)
rdma_return_path = qemu_rdma_data_init(rdma->host_port, NULL);
if (rdma_return_path == NULL) {
rdma_ack_cm_event(cm_event);
+ ret = -1;
goto err_rdma_dest_wait;
}
@@ -3375,10 +3377,11 @@ static int qemu_rdma_accept(RDMAContext *rdma)
network_to_caps(&cap);
if (cap.version < 1 || cap.version > RDMA_CONTROL_VERSION_CURRENT) {
- error_report("Unknown source RDMA version: %d, bailing...",
- cap.version);
- rdma_ack_cm_event(cm_event);
- goto err_rdma_dest_wait;
+ error_report("Unknown source RDMA version: %d, bailing...",
+ cap.version);
+ rdma_ack_cm_event(cm_event);
+ ret = -1;
+ goto err_rdma_dest_wait;
}
/*
@@ -3408,9 +3411,10 @@ static int qemu_rdma_accept(RDMAContext *rdma)
if (!rdma->verbs) {
rdma->verbs = verbs;
} else if (rdma->verbs != verbs) {
- error_report("ibv context not matching %p, %p!", rdma->verbs,
- verbs);
- goto err_rdma_dest_wait;
+ error_report("ibv context not matching %p, %p!", rdma->verbs,
+ verbs);
+ ret = -1;
+ goto err_rdma_dest_wait;
}
qemu_rdma_dump_id("dest_init", verbs);
@@ -3467,6 +3471,7 @@ static int qemu_rdma_accept(RDMAContext *rdma)
if (cm_event->event != RDMA_CM_EVENT_ESTABLISHED) {
error_report("rdma_accept not event established");
rdma_ack_cm_event(cm_event);
+ ret = -1;
goto err_rdma_dest_wait;
}
--
2.41.0
- Re: [PATCH 43/52] migration/rdma: Convert qemu_rdma_alloc_pd_cq() to Error, (continued)
- [PATCH 18/52] migration/rdma: Fix qemu_rdma_broken_ipv6_kernel() to set error, Markus Armbruster, 2023/09/18
- [PATCH 31/52] migration/rdma: Retire macro ERROR(), Markus Armbruster, 2023/09/18
- [PATCH 44/52] migration/rdma: Silence qemu_rdma_resolve_host(), Markus Armbruster, 2023/09/18
- [PATCH 29/52] migration/rdma: Plug a memory leak and improve a message, Markus Armbruster, 2023/09/18
- [PATCH 08/52] migration/rdma: Fix qemu_rdma_accept() to return failure on errors,
Markus Armbruster <=
- [PATCH 24/52] migration/rdma: Return -1 instead of negative errno code, Markus Armbruster, 2023/09/18
- [PATCH 42/52] migration/rdma: Convert qemu_rdma_post_recv_control() to Error, Markus Armbruster, 2023/09/18
- [PATCH 35/52] migration/rdma: Convert qemu_rdma_exchange_send() to Error, Markus Armbruster, 2023/09/18
- [PATCH 50/52] migration/rdma: Silence qemu_rdma_cleanup(), Markus Armbruster, 2023/09/18