76daa3
From efbb3025bc242760ac4294d5f636490811b2f612 Mon Sep 17 00:00:00 2001
76daa3
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
76daa3
Date: Thu, 27 Jul 2017 12:06:56 +0200
76daa3
Subject: [PATCH 08/17] migration/rdma: fix qemu_rdma_block_for_wrid error
76daa3
 paths
76daa3
76daa3
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
76daa3
Message-id: <20170727120659.8640-3-dgilbert@redhat.com>
76daa3
Patchwork-id: 75858
76daa3
O-Subject: [Pegas-1.0 qemu-kvm PATCH 2/5] migration/rdma: fix qemu_rdma_block_for_wrid error paths
76daa3
Bugzilla: 1475751
76daa3
RH-Acked-by: Peter Xu <peterx@redhat.com>
76daa3
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
76daa3
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
76daa3
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
76daa3
76daa3
The two places that 'goto err_block_for_wrid' weren't setting ret
76daa3
and so would end up returning 0 even though we've failed.
76daa3
76daa3
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
76daa3
Reviewed-by: Peter Xu <peterx@redhat.com>
76daa3
Message-Id: <20170717110936.23314-4-dgilbert@redhat.com>
76daa3
Signed-off-by: Juan Quintela <quintela@redhat.com>
76daa3
(cherry picked from commit 0b3c15f09715acd78063e720444cc86ac357bab4)
76daa3
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
---
76daa3
 migration/rdma.c | 8 ++++++--
76daa3
 1 file changed, 6 insertions(+), 2 deletions(-)
76daa3
76daa3
diff --git a/migration/rdma.c b/migration/rdma.c
76daa3
index 0f6669e..44a174f 100644
76daa3
--- a/migration/rdma.c
76daa3
+++ b/migration/rdma.c
76daa3
@@ -1519,14 +1519,16 @@ static int qemu_rdma_block_for_wrid(RDMAContext *rdma, int wrid_requested,
76daa3
             yield_until_fd_readable(rdma->comp_channel->fd);
76daa3
         }
76daa3
 
76daa3
-        if (ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx)) {
76daa3
+        ret = ibv_get_cq_event(rdma->comp_channel, &cq, &cq_ctx);
76daa3
+        if (ret) {
76daa3
             perror("ibv_get_cq_event");
76daa3
             goto err_block_for_wrid;
76daa3
         }
76daa3
 
76daa3
         num_cq_events++;
76daa3
 
76daa3
-        if (ibv_req_notify_cq(cq, 0)) {
76daa3
+        ret = -ibv_req_notify_cq(cq, 0);
76daa3
+        if (ret) {
76daa3
             goto err_block_for_wrid;
76daa3
         }
76daa3
 
76daa3
@@ -1562,6 +1564,8 @@ err_block_for_wrid:
76daa3
     if (num_cq_events) {
76daa3
         ibv_ack_cq_events(cq, num_cq_events);
76daa3
     }
76daa3
+
76daa3
+    rdma->error_state = ret;
76daa3
     return ret;
76daa3
 }
76daa3
 
76daa3
-- 
76daa3
1.8.3.1
76daa3