Skip to contentSkip to conversation

migration: fix detached migration with fd

PATCH Applied Juan Quintela 3 participants 3 messages Nov 9, 2011 – Nov 11, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 migration: fix detached migration with fd

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 <[email protected]>

---
 migration.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
migration.c +10 -2
index 4b17566..41c3c24 100644
@@ -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;
 }
Signature · 1 line
1.7.7
#1 lore raw
Quoted 3 lines · Juan Quintela

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

#2 lore raw
In reply to Juan Quintela
Quoted 8 lines · Juan Quintela

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<[email protected]>

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 41 lines
---
  migration.c |   12 ++++++++++--
  1 files changed, 10 insertions(+), 2 deletions(-)
migration.c +10 -2
index 4b17566..41c3c24 100644
@@ -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;
  }