summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-03-30 19:58:17 +0100
committerPeter Maydell <peter.maydell@linaro.org>2018-03-30 19:58:17 +0100
commit4cd327ded7337c418da114c184cf5868fd980ab4 (patch)
tree6f6dbaf375f303d0bf337dcc0c519006d41e1bf5
parent47d3b60858d90ac8a0cc3a72af7f95c96781125a (diff)
parent0746a92612276aee69e66dfe6782b0f882d221d5 (diff)
downloadfocaccia-qemu-4cd327ded7337c418da114c184cf5868fd980ab4.tar.gz
focaccia-qemu-4cd327ded7337c418da114c184cf5868fd980ab4.zip
Merge remote-tracking branch 'remotes/dgilbert/tags/pull-migration-20180329a' into staging
Migration pull (small fixes)

A pair of two small fixes for 2.12.

# gpg: Signature made Thu 29 Mar 2018 14:55:17 BST
# gpg:                using RSA key 0516331EBC5BFDE7
# gpg: Good signature from "Dr. David Alan Gilbert (RH2) <dgilbert@redhat.com>"
# Primary key fingerprint: 45F5 C71B 4A0C B7FB 977A  9FA9 0516 331E BC5B FDE7

* remotes/dgilbert/tags/pull-migration-20180329a:
  migration: Don't activate block devices if using -S
  migration: fix pfd leak

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--migration/migration.c22
-rw-r--r--migration/postcopy-ram.c1
2 files changed, 16 insertions, 7 deletions
diff --git a/migration/migration.c b/migration/migration.c
index 52a5092add..58bd382730 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -306,13 +306,21 @@ static void process_incoming_migration_bh(void *opaque)
     Error *local_err = NULL;
     MigrationIncomingState *mis = opaque;
 
-    /* Make sure all file formats flush their mutable metadata.
-     * If we get an error here, just don't restart the VM yet. */
-    bdrv_invalidate_cache_all(&local_err);
-    if (local_err) {
-        error_report_err(local_err);
-        local_err = NULL;
-        autostart = false;
+    /* Only fire up the block code now if we're going to restart the
+     * VM, else 'cont' will do it.
+     * This causes file locking to happen; so we don't want it to happen
+     * unless we really are starting the VM.
+     */
+    if (autostart && (!global_state_received() ||
+        global_state_get_runstate() == RUN_STATE_RUNNING)) {
+        /* Make sure all file formats flush their mutable metadata.
+         * If we get an error here, just don't restart the VM yet. */
+        bdrv_invalidate_cache_all(&local_err);
+        if (local_err) {
+            error_report_err(local_err);
+            local_err = NULL;
+            autostart = false;
+        }
     }
 
     /*
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index efd77939af..4a0b33b373 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -754,6 +754,7 @@ static void *postcopy_ram_fault_thread(void *opaque)
         }
     }
     trace_postcopy_ram_fault_thread_exit();
+    g_free(pfd);
     return NULL;
 }