]> git.proxmox.com Git - qemu.git/blobdiff - migration.c
memory: temporarily suppress the subregion collision warning
[qemu.git] / migration.c
index 2a15b98db9f328022893972bb4b62b4b3a9aee7c..f5959b4391712972373dd18fc77d847cc05d1826 100644 (file)
@@ -292,18 +292,17 @@ int migrate_fd_cleanup(FdMigrationState *s)
             ret = -1;
         }
         s->file = NULL;
+    } else {
+        if (s->mon) {
+            monitor_resume(s->mon);
+        }
     }
 
-    if (s->fd != -1)
+    if (s->fd != -1) {
         close(s->fd);
-
-    /* Don't resume monitor until we've flushed all of the buffers */
-    if (s->mon) {
-        monitor_resume(s->mon);
+        s->fd = -1;
     }
 
-    s->fd = -1;
-
     return ret;
 }
 
@@ -330,9 +329,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, NULL);
     }
@@ -432,7 +428,7 @@ void migrate_fd_release(MigrationState *mig_state)
         notifier_list_notify(&migration_state_notifiers, NULL);
         migrate_fd_cleanup(s);
     }
-    qemu_free(s);
+    g_free(s);
 }
 
 void migrate_fd_wait_for_unfreeze(void *opaque)
@@ -458,6 +454,9 @@ int migrate_fd_close(void *opaque)
 {
     FdMigrationState *s = opaque;
 
+    if (s->mon) {
+        monitor_resume(s->mon);
+    }
     qemu_set_fd_handler2(s->fd, NULL, NULL, NULL, NULL);
     return s->close(s);
 }