All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/2] Fix error handling in migration when the peer is killed.
@ 2011-02-22 15:01 Yoshiaki Tamura
  2011-02-22 15:01 ` [Qemu-devel] [PATCH 1/2] savevm: avoid qemu_savevm_state_iteate() to return 1 when qemu file has error Yoshiaki Tamura
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Yoshiaki Tamura @ 2011-02-22 15:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Yoshiaki Tamura

Hi,

During live migration, if the receiver side of qemu gets killed, the
sender side seems to be handling the error incorrectly, like it passes
the iterate phase (stage 2) and moves on to the complete state (stage
3).  These patches fix the issue.

Yoshiaki Tamura (2):
  savevm: avoid qemu_savevm_state_iteate() to return 1 when qemu file
    has error.
  migration: add error handling to migrate_fd_put_notify().

 migration.c |    9 +++------
 savevm.c    |    7 ++++---
 2 files changed, 7 insertions(+), 9 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 1/2] savevm: avoid qemu_savevm_state_iteate() to return 1 when qemu file has error.
  2011-02-22 15:01 [Qemu-devel] [PATCH 0/2] Fix error handling in migration when the peer is killed Yoshiaki Tamura
@ 2011-02-22 15:01 ` Yoshiaki Tamura
  2011-02-22 15:01 ` [Qemu-devel] [PATCH 2/2] migration: add error handling to migrate_fd_put_notify() Yoshiaki Tamura
  2011-02-23  9:39 ` [Qemu-devel] Re: [PATCH 0/2] Fix error handling in migration when the peer is killed Juan Quintela
  2 siblings, 0 replies; 5+ messages in thread
From: Yoshiaki Tamura @ 2011-02-22 15:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Yoshiaki Tamura

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(-)

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;
 }
 
-- 
1.7.1.2

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PATCH 2/2] migration: add error handling to migrate_fd_put_notify().
  2011-02-22 15:01 [Qemu-devel] [PATCH 0/2] Fix error handling in migration when the peer is killed Yoshiaki Tamura
  2011-02-22 15:01 ` [Qemu-devel] [PATCH 1/2] savevm: avoid qemu_savevm_state_iteate() to return 1 when qemu file has error Yoshiaki Tamura
@ 2011-02-22 15:01 ` Yoshiaki Tamura
  2011-02-23  9:39 ` [Qemu-devel] Re: [PATCH 0/2] Fix error handling in migration when the peer is killed Juan Quintela
  2 siblings, 0 replies; 5+ messages in thread
From: Yoshiaki Tamura @ 2011-02-22 15:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: pbonzini, Yoshiaki Tamura

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>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] Re: [PATCH 0/2] Fix error handling in migration when the peer is killed.
  2011-02-22 15:01 [Qemu-devel] [PATCH 0/2] Fix error handling in migration when the peer is killed Yoshiaki Tamura
  2011-02-22 15:01 ` [Qemu-devel] [PATCH 1/2] savevm: avoid qemu_savevm_state_iteate() to return 1 when qemu file has error Yoshiaki Tamura
  2011-02-22 15:01 ` [Qemu-devel] [PATCH 2/2] migration: add error handling to migrate_fd_put_notify() Yoshiaki Tamura
@ 2011-02-23  9:39 ` Juan Quintela
  2011-02-23  9:51   ` Yoshiaki Tamura
  2 siblings, 1 reply; 5+ messages in thread
From: Juan Quintela @ 2011-02-23  9:39 UTC (permalink / raw)
  To: Yoshiaki Tamura; +Cc: pbonzini, qemu-devel

Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> wrote:
> Hi,
>
> During live migration, if the receiver side of qemu gets killed, the
> sender side seems to be handling the error incorrectly, like it passes
> the iterate phase (stage 2) and moves on to the complete state (stage
> 3).  These patches fix the issue.
>

Agreed. Integrated into my series of cleanups. Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Re: [PATCH 0/2] Fix error handling in migration when the peer is killed.
  2011-02-23  9:39 ` [Qemu-devel] Re: [PATCH 0/2] Fix error handling in migration when the peer is killed Juan Quintela
@ 2011-02-23  9:51   ` Yoshiaki Tamura
  0 siblings, 0 replies; 5+ messages in thread
From: Yoshiaki Tamura @ 2011-02-23  9:51 UTC (permalink / raw)
  To: quintela; +Cc: pbonzini, qemu-devel

2011/2/23 Juan Quintela <quintela@redhat.com>:
> Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp> wrote:
>> Hi,
>>
>> During live migration, if the receiver side of qemu gets killed, the
>> sender side seems to be handling the error incorrectly, like it passes
>> the iterate phase (stage 2) and moves on to the complete state (stage
>> 3).  These patches fix the issue.
>>
>
> Agreed. Integrated into my series of cleanups. Thanks.

Thanks!

Yoshi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-02-23  9:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-22 15:01 [Qemu-devel] [PATCH 0/2] Fix error handling in migration when the peer is killed Yoshiaki Tamura
2011-02-22 15:01 ` [Qemu-devel] [PATCH 1/2] savevm: avoid qemu_savevm_state_iteate() to return 1 when qemu file has error Yoshiaki Tamura
2011-02-22 15:01 ` [Qemu-devel] [PATCH 2/2] migration: add error handling to migrate_fd_put_notify() Yoshiaki Tamura
2011-02-23  9:39 ` [Qemu-devel] Re: [PATCH 0/2] Fix error handling in migration when the peer is killed Juan Quintela
2011-02-23  9:51   ` Yoshiaki Tamura

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.