qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 05/11] migration: add error handling to migrate_


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 05/11] migration: add error handling to migrate_fd_put_notify().
Date: Fri, 23 Sep 2011 15:45:27 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0.2) Gecko/20110906 Thunderbird/6.0.2

On 09/23/2011 02:50 PM, Juan Quintela wrote:
From: Yoshiaki Tamura<address@hidden>

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>
Signed-off-by: Juan Quintela<address@hidden>
---
  migration.c |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/migration.c b/migration.c
index 9498e20..0b284ff 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,9 +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) {
-        s->state = MIG_STATE_ERROR;
-        notifier_list_notify(&migration_state_notifiers, NULL);
      }

      return ret;

Why not leave both (or even better, call migrate_fd_error in the else branch)?

Paolo



reply via email to

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