Blob Blame History Raw
From efbb3025bc242760ac4294d5f636490811b2f612 Mon Sep 17 00:00:00 2001
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Date: Thu, 27 Jul 2017 12:06:56 +0200
Subject: [PATCH 08/17] migration/rdma: fix qemu_rdma_block_for_wrid error
 paths

RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: <20170727120659.8640-3-dgilbert@redhat.com>
Patchwork-id: 75858
O-Subject: [Pegas-1.0 qemu-kvm PATCH 2/5] migration/rdma: fix qemu_rdma_block_for_wrid error paths
Bugzilla: 1475751
RH-Acked-by: Peter Xu <peterx@redhat.com>
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

The two places that 'goto err_block_for_wrid' weren't setting ret
and so would end up returning 0 even though we've failed.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Message-Id: <20170717110936.23314-4-dgilbert@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit 0b3c15f09715acd78063e720444cc86ac357bab4)
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 migration/rdma.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/migration/rdma.c b/migration/rdma.c
index 0f6669e..44a174f 100644
--- a/migration/rdma.c
+++ b/migration/rdma.c
@@ -1519,14 +1519,16 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested,
             yield_until_fd_readable(rdma->comp_channel->fd);
         }
 
-        if (ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx)) {
+        ret = ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx);
+        if (ret) {
             perror("ibv_get_cq_event");
             goto err_block_for_wrid;
         }
 
         num_cq_events++;
 
-        if (ibv_req_notify_cq(cq, 0)) {
+        ret = -ibv_req_notify_cq(cq, 0);
+        if (ret) {
             goto err_block_for_wrid;
         }
 
@@ -1562,6 +1564,8 @@ err_block_for_wrid:
     if (num_cq_events) {
         ibv_ack_cq_events(cq, num_cq_events);
     }
+
+    rdma->error_state = ret;
     return ret;
 }
 
-- 
1.8.3.1