All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] migration: Don't activate block devices if using -S
@ 2018-03-28 17:02 Dr. David Alan Gilbert (git)
  2018-03-28 17:38 ` [Qemu-devel] [PATCH for-2.12] " Eric Blake
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2018-03-28 17:02 UTC (permalink / raw)
  To: qemu-devel, quintela, famz, kwolf, jdenemar, peterx

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Activating the block devices causes the locks to be taken on
the backing file.  If we're running with -S and the destination libvirt
hasn't started the destination with 'cont', it's expecting the locks are
still untaken.

Don't activate the block devices if we're not going to autostart the VM;
'cont' already will do that anyway.

bz: https://bugzilla.redhat.com/show_bug.cgi?id=1560854
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/migration.c | 22 +++++++++++++++-------
 1 file changed, 15 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;
+        }
     }
 
     /*
-- 
2.14.3

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

end of thread, other threads:[~2018-04-11 13:12 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 17:02 [Qemu-devel] [PATCH] migration: Don't activate block devices if using -S Dr. David Alan Gilbert (git)
2018-03-28 17:38 ` [Qemu-devel] [PATCH for-2.12] " Eric Blake
2018-03-29  9:45 ` [Qemu-devel] [PATCH] " Dr. David Alan Gilbert
2018-03-31  7:56 ` no-reply
2018-04-03 14:38 ` Kevin Wolf
2018-04-03 20:52   ` Dr. David Alan Gilbert
2018-04-04 10:03     ` Kevin Wolf
2018-04-09 10:27       ` Dr. David Alan Gilbert
2018-04-09 13:40         ` Kevin Wolf
2018-04-09 14:04           ` Dr. David Alan Gilbert
2018-04-09 15:25             ` Kevin Wolf
2018-04-09 15:35               ` Dr. David Alan Gilbert
2018-04-10  7:36           ` Jiri Denemark
2018-04-10  8:18             ` Kevin Wolf
2018-04-10  8:45               ` Dr. David Alan Gilbert
2018-04-10  9:14                 ` Kevin Wolf
2018-04-10 10:40                   ` Dr. David Alan Gilbert
2018-04-10 12:26                     ` Kevin Wolf
2018-04-10 14:22                       ` Dr. David Alan Gilbert
2018-04-10 14:47                         ` Kevin Wolf
2018-04-11 10:01                           ` Jiri Denemark
2018-04-11 12:49                             ` Kevin Wolf
2018-04-11 13:12                               ` Dr. David Alan Gilbert
2018-04-09 15:28       ` Jiri Denemark

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.