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

login
register
mail settings
Submitter Yoshiaki Tamura
Date Feb. 22, 2011, 3:01 p.m.
Message ID <1298386884-17514-2-git-send-email-tamura.yoshiaki@lab.ntt.co.jp>
Download mbox | patch
Permalink /patch/83978/
State New
Headers show

Comments

Yoshiaki Tamura - Feb. 22, 2011, 3:01 p.m.
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>
---
 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;
 }