qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: fix detached migration with fd
@ 2011-11-09 20:29 Juan Quintela
  2011-11-10  1:48 ` Stefan Berger
  2011-11-11 19:45 ` Anthony Liguori
  0 siblings, 2 replies; 3+ messages in thread
From: Juan Quintela @ 2011-11-09 20:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: aliguori

Migration with fd uses s->mon to pass the fd.  But we only assign the
s->mon for !detached migration.  Fix it.  Once there add a comment
indicating that s->mon has two uses.

Bug reported by:  Wen Congyang <wency@cn.fujitsu.com>

Signed-off-by: Juan Quintela <quintela@redhat.com>
CC:  Wen Congyang <wency@cn.fujitsu.com>
---
 migration.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/migration.c b/migration.c
index 4b17566..41c3c24 100644
--- a/migration.c
+++ b/migration.c
@@ -155,7 +155,6 @@ MigrationInfo *qmp_query_migrate(Error **errp)

 static void migrate_fd_monitor_suspend(MigrationState *s, Monitor *mon)
 {
-    s->mon = mon;
     if (monitor_suspend(mon) == 0) {
         DPRINTF("suspending monitor\n");
     } else {
@@ -383,7 +382,12 @@ static MigrationState *migrate_init(Monitor *mon, int detach, int blk, int inc)
     s->bandwidth_limit = bandwidth_limit;
     s->blk = blk;
     s->shared = inc;
-    s->mon = NULL;
+
+    /* s->mon is used for two things:
+       - pass fd in fd migration
+       - suspend/resume monitor for not detached migration
+    */
+    s->mon = mon;
     s->bandwidth_limit = bandwidth_limit;
     s->state = MIG_STATE_SETUP;

@@ -435,6 +439,10 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
         return ret;
     }

+    if (detach) {
+        s->mon = NULL;
+    }
+
     notifier_list_notify(&migration_state_notifiers, s);
     return 0;
 }
-- 
1.7.7

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

* Re: [Qemu-devel] [PATCH] migration: fix detached migration with fd
  2011-11-09 20:29 [Qemu-devel] [PATCH] migration: fix detached migration with fd Juan Quintela
@ 2011-11-10  1:48 ` Stefan Berger
  2011-11-11 19:45 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Berger @ 2011-11-10  1:48 UTC (permalink / raw)
  To: Juan Quintela; +Cc: aliguori, qemu-devel

On 11/09/2011 03:29 PM, Juan Quintela wrote:
> Migration with fd uses s->mon to pass the fd.  But we only assign the
> s->mon for !detached migration.  Fix it.  Once there add a comment
> indicating that s->mon has two uses.

I had encounter the NULL pointer problem when suspending using 'virsh 
save...'. Now with your patch it unfortunately doesn't terminate, i.e., 
qemu is still running while the file has been written completely.

    Stefan

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

* Re: [Qemu-devel] [PATCH] migration: fix detached migration with fd
  2011-11-09 20:29 [Qemu-devel] [PATCH] migration: fix detached migration with fd Juan Quintela
  2011-11-10  1:48 ` Stefan Berger
@ 2011-11-11 19:45 ` Anthony Liguori
  1 sibling, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2011-11-11 19:45 UTC (permalink / raw)
  To: Juan Quintela; +Cc: qemu-devel

On 11/09/2011 02:29 PM, Juan Quintela wrote:
> Migration with fd uses s->mon to pass the fd.  But we only assign the
> s->mon for !detached migration.  Fix it.  Once there add a comment
> indicating that s->mon has two uses.
>
> Bug reported by:  Wen Congyang<wency@cn.fujitsu.com>
>
> Signed-off-by: Juan Quintela<quintela@redhat.com>
> CC:  Wen Congyang<wency@cn.fujitsu.com>

Applied.  Thanks.

Regards,

Anthony Liguori

> ---
>   migration.c |   12 ++++++++++--
>   1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/migration.c b/migration.c
> index 4b17566..41c3c24 100644
> --- a/migration.c
> +++ b/migration.c
> @@ -155,7 +155,6 @@ MigrationInfo *qmp_query_migrate(Error **errp)
>
>   static void migrate_fd_monitor_suspend(MigrationState *s, Monitor *mon)
>   {
> -    s->mon = mon;
>       if (monitor_suspend(mon) == 0) {
>           DPRINTF("suspending monitor\n");
>       } else {
> @@ -383,7 +382,12 @@ static MigrationState *migrate_init(Monitor *mon, int detach, int blk, int inc)
>       s->bandwidth_limit = bandwidth_limit;
>       s->blk = blk;
>       s->shared = inc;
> -    s->mon = NULL;
> +
> +    /* s->mon is used for two things:
> +       - pass fd in fd migration
> +       - suspend/resume monitor for not detached migration
> +    */
> +    s->mon = mon;
>       s->bandwidth_limit = bandwidth_limit;
>       s->state = MIG_STATE_SETUP;
>
> @@ -435,6 +439,10 @@ int do_migrate(Monitor *mon, const QDict *qdict, QObject **ret_data)
>           return ret;
>       }
>
> +    if (detach) {
> +        s->mon = NULL;
> +    }
> +
>       notifier_list_notify(&migration_state_notifiers, s);
>       return 0;
>   }

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

end of thread, other threads:[~2011-11-11 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-09 20:29 [Qemu-devel] [PATCH] migration: fix detached migration with fd Juan Quintela
2011-11-10  1:48 ` Stefan Berger
2011-11-11 19:45 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).