76daa3
From 645b33dbf1c58f184b4b7a1f78f8540fa46e5df7 Mon Sep 17 00:00:00 2001
76daa3
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
76daa3
Date: Thu, 27 Jul 2017 12:06:59 +0200
76daa3
Subject: [PATCH 11/17] migration/rdma: Send error during cancelling
76daa3
76daa3
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
76daa3
Message-id: <20170727120659.8640-6-dgilbert@redhat.com>
76daa3
Patchwork-id: 75861
76daa3
O-Subject: [Pegas-1.0 qemu-kvm PATCH 5/5] migration/rdma: Send error during cancelling
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
When we issue a cancel and clean up the RDMA channel
76daa3
send a CONTROL_ERROR to get the destination to quit.
76daa3
76daa3
The rdma_cleanup code waits for the event to come back
76daa3
from the rdma_disconnect; but that wont happen until the
76daa3
destination quits and there's currently nothing to force
76daa3
it.
76daa3
76daa3
Note this makes the case of a cancel work while the destination
76daa3
is alive, and it already works if the destination is
76daa3
truly dead.  Note it doesn't fix the case where the destination
76daa3
is hung (we get stuck waiting for the rdma_disconnect event).
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-7-dgilbert@redhat.com>
76daa3
Signed-off-by: Juan Quintela <quintela@redhat.com>
76daa3
(cherry picked from commit 32bce196344772df8d68ab40e2dd1dd57be1aa7c)
76daa3
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
76daa3
---
76daa3
 migration/rdma.c | 4 +++-
76daa3
 1 file changed, 3 insertions(+), 1 deletion(-)
76daa3
76daa3
diff --git a/migration/rdma.c b/migration/rdma.c
76daa3
index fa88ccf..cc319a1 100644
76daa3
--- a/migration/rdma.c
76daa3
+++ b/migration/rdma.c
76daa3
@@ -2267,7 +2267,9 @@ static void qemu_rdma_cleanup(RDMAContext *rdma)
76daa3
     int ret, idx;
76daa3
 
76daa3
     if (rdma->cm_id && rdma->connected) {
76daa3
-        if (rdma->error_state && !rdma->received_error) {
76daa3
+        if ((rdma->error_state ||
76daa3
+             migrate_get_current()->state == MIGRATION_STATUS_CANCELLING) &&
76daa3
+            !rdma->received_error) {
76daa3
             RDMAControlHeader head = { .len = 0,
76daa3
                                        .type = RDMA_CONTROL_ERROR,
76daa3
                                        .repeat = 1,
76daa3
-- 
76daa3
1.8.3.1
76daa3