Patchwork [22/28] savevm: avoid qemu_savevm_state_iteate() to return 1 when qemu file has error.

login
register
mail settings
Submitter Juan Quintela
Date Feb. 23, 2011, 9:47 p.m.
Message ID <e67825ab137296dee58715cda2fbb7bbcabf7b13.1298492768.git.quintela@redhat.com>
Download mbox | patch
Permalink /patch/84257/
State New
Headers show

Comments

Juan Quintela - Feb. 23, 2011, 9:47 p.m.
From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>

When qemu on the receiver gets killed during live migration, if debug
is turned on, migrate_fd_put_ready() says,

migration: done iterating

and proceeds.  The reason was qemu_savevm_state_iterate() returning 1
even when qemu file has error.  This patch checks
qemu_file_has_error() before returning 1/0, and avoids
migrate_fd_put_ready() to proceed in case of error.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 savevm.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Patch

diff --git a/savevm.c b/savevm.c
index a50fd31..1a0be58 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1501,14 +1501,15 @@  int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f)
         }
     }

-    if (ret)
-        return 1;
-
     if (qemu_file_has_error(f)) {
         qemu_savevm_state_cancel(mon, f);
         return -EIO;
     }

+    if (ret) {
+        return 1;
+    }
+
     return 0;
 }