diff mbox

[23/28] migration: add error handling to migrate_fd_put_notify().

Message ID 1441db4c684621ce46ea35790e9da2799a2c0341.1298492768.git.quintela@redhat.com
State New
Headers show

Commit Message

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

Although migrate_fd_put_buffer() sets MIG_STATE_ERROR if it failed,
since migrate_fd_put_notify() isn't checking error of underlying
QEMUFile, those resources are kept open.  This patch checks it and
calls migrate_fd_error() in case of error.

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

Patch

diff --git a/migration.c b/migration.c
index 697c74f..a02100b 100644
--- a/migration.c
+++ b/migration.c
@@ -241,6 +241,9 @@  static void migrate_fd_put_notify(void *opaque)

     qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
     qemu_file_put_notify(s->file);
+    if (qemu_file_has_error(s->file)) {
+        migrate_fd_error(s);
+    }
 }

 static ssize_t migrate_fd_put_buffer(void *opaque, const void *data,
@@ -258,12 +261,6 @@  static ssize_t migrate_fd_put_buffer(void *opaque, const void *data,

     if (ret == -EAGAIN) {
         qemu_set_fd_handler2(s->fd, NULL, NULL, migrate_fd_put_notify, s);
-    } else if (ret < 0) {
-        if (s->mon) {
-            monitor_resume(s->mon);
-        }
-        s->state = MIG_STATE_ERROR;
-        notifier_list_notify(&migration_state_notifiers);
     }

     return ret;