qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] migration: add error handling to migrate_fd_put


From: Yoshiaki Tamura
Subject: [Qemu-devel] [PATCH 2/2] migration: add error handling to migrate_fd_put_notify().
Date: Wed, 23 Feb 2011 00:01:24 +0900

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 <address@hidden>
---
 migration.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/migration.c b/migration.c
index af3a1f2..14a125f 100644
--- a/migration.c
+++ b/migration.c
@@ -313,6 +313,9 @@ 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);
+    }
 }
 
 ssize_t migrate_fd_put_buffer(void *opaque, const void *data, size_t size)
@@ -329,12 +332,6 @@ ssize_t migrate_fd_put_buffer(void *opaque, const void 
*data, size_t size)
 
     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;
-- 
1.7.1.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]