yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-multifd-Make-sure-that-we-don-t-do-any-IO-after-an-e.patch

ddf19c
From 78c7fb5afcb298631df47f6b71cf764f921c15f4 Mon Sep 17 00:00:00 2001
ddf19c
From: Juan Quintela <quintela@redhat.com>
ddf19c
Date: Tue, 3 Mar 2020 14:51:38 +0000
ddf19c
Subject: [PATCH 06/18] multifd: Make sure that we don't do any IO after an
ddf19c
 error
ddf19c
ddf19c
RH-Author: Juan Quintela <quintela@redhat.com>
ddf19c
Message-id: <20200303145143.149290-6-quintela@redhat.com>
ddf19c
Patchwork-id: 94118
ddf19c
O-Subject: [RHEL-AV-8.2.0 qemu-kvm PATCH v2 05/10] multifd: Make sure that we don't do any IO after an error
ddf19c
Bugzilla: 1738451
ddf19c
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ddf19c
RH-Acked-by: Peter Xu <peterx@redhat.com>
ddf19c
RH-Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
ddf19c
Signed-off-by: Juan Quintela <quintela@redhat.com>
ddf19c
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
ddf19c
(cherry picked from commit 3d4095b222d97393b1c2c6e514951ec7798f1c43)
ddf19c
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ddf19c
---
ddf19c
 migration/ram.c | 22 +++++++++++++---------
ddf19c
 1 file changed, 13 insertions(+), 9 deletions(-)
ddf19c
ddf19c
diff --git a/migration/ram.c b/migration/ram.c
ddf19c
index 6c55c5d..a0257ee 100644
ddf19c
--- a/migration/ram.c
ddf19c
+++ b/migration/ram.c
ddf19c
@@ -3440,7 +3440,7 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
ddf19c
 {
ddf19c
     RAMState **temp = opaque;
ddf19c
     RAMState *rs = *temp;
ddf19c
-    int ret;
ddf19c
+    int ret = 0;
ddf19c
     int i;
ddf19c
     int64_t t0;
ddf19c
     int done = 0;
ddf19c
@@ -3511,12 +3511,14 @@ static int ram_save_iterate(QEMUFile *f, void *opaque)
ddf19c
     ram_control_after_iterate(f, RAM_CONTROL_ROUND);
ddf19c
 
ddf19c
 out:
ddf19c
-    multifd_send_sync_main(rs);
ddf19c
-    qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
ddf19c
-    qemu_fflush(f);
ddf19c
-    ram_counters.transferred += 8;
ddf19c
+    if (ret >= 0) {
ddf19c
+        multifd_send_sync_main(rs);
ddf19c
+        qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
ddf19c
+        qemu_fflush(f);
ddf19c
+        ram_counters.transferred += 8;
ddf19c
 
ddf19c
-    ret = qemu_file_get_error(f);
ddf19c
+        ret = qemu_file_get_error(f);
ddf19c
+    }
ddf19c
     if (ret < 0) {
ddf19c
         return ret;
ddf19c
     }
ddf19c
@@ -3568,9 +3570,11 @@ static int ram_save_complete(QEMUFile *f, void *opaque)
ddf19c
         ram_control_after_iterate(f, RAM_CONTROL_FINISH);
ddf19c
     }
ddf19c
 
ddf19c
-    multifd_send_sync_main(rs);
ddf19c
-    qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
ddf19c
-    qemu_fflush(f);
ddf19c
+    if (ret >= 0) {
ddf19c
+        multifd_send_sync_main(rs);
ddf19c
+        qemu_put_be64(f, RAM_SAVE_FLAG_EOS);
ddf19c
+        qemu_fflush(f);
ddf19c
+    }
ddf19c
 
ddf19c
     return ret;
ddf19c
 }
ddf19c
-- 
ddf19c
1.8.3.1
ddf19c