Blame SOURCES/kvm-migration-Support-adding-migration-blockers-earlier.patch

7711c0
From 7d01c30800f4009d770cb44e377886a7a47f3e47 Mon Sep 17 00:00:00 2001
7711c0
From: Markus Armbruster <armbru@redhat.com>
7711c0
Date: Fri, 17 May 2019 06:51:20 +0200
7711c0
Subject: [PATCH 53/53] migration: Support adding migration blockers earlier
7711c0
MIME-Version: 1.0
7711c0
Content-Type: text/plain; charset=UTF-8
7711c0
Content-Transfer-Encoding: 8bit
7711c0
7711c0
RH-Author: Markus Armbruster <armbru@redhat.com>
7711c0
Message-id: <20190517065120.12028-32-armbru@redhat.com>
7711c0
Patchwork-id: 88011
7711c0
O-Subject: [RHEL-7.7 qemu-kvm-rhev PATCH v3 31/31] migration: Support adding migration blockers earlier
7711c0
Bugzilla: 1624009
7711c0
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7711c0
RH-Acked-by: Thomas Huth <thuth@redhat.com>
7711c0
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
7711c0
migrate_add_blocker() asserts we have a current_migration object, in
7711c0
migrate_get_current().  We do only after migration_object_init().
7711c0
7711c0
This contributes to the following dependency cycle:
7711c0
7711c0
* configure_blockdev() must run before machine_set_property()
7711c0
  so machine properties can refer to block backends
7711c0
7711c0
* machine_set_property() before configure_accelerator()
7711c0
  so machine properties like kvm-irqchip get applied
7711c0
7711c0
* configure_accelerator() before migration_object_init()
7711c0
  so that Xen's accelerator compat properties get applied.
7711c0
7711c0
* migration_object_init() before configure_blockdev()
7711c0
  so configure_blockdev() can add migration blockers
7711c0
7711c0
The cycle was closed when recent commit cda4aa9a5a0 "Create block
7711c0
backends before setting machine properties" added the first
7711c0
dependency, and satisfied it by violating the last one.  Broke block
7711c0
backends that add migration blockers, as demonstrated by qemu-iotests
7711c0
055.
7711c0
7711c0
To fix it, break the last dependency: make migrate_add_blocker()
7711c0
usable before migration_object_init().
7711c0
7711c0
The previous commit already removed the use of migrate_get_current()
7711c0
from migrate_add_blocker() itself.  Didn't quite do the trick, as
7711c0
there's another one hiding in migration_is_idle().
7711c0
7711c0
The use there isn't actually necessary: when no migration object has
7711c0
been created yet, migration is surely idle.  Make migration_is_idle()
7711c0
return true then.
7711c0
7711c0
Fixes: cda4aa9a5a08777cf13e164c0543bd4888b8adce
7711c0
Signed-off-by: Markus Armbruster <armbru@redhat.com>
7711c0
Message-Id: <20190401090827.20793-4-armbru@redhat.com>
7711c0
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
7711c0
(cherry picked from commit daff7f0bbe9950d045bb5b74f202295f70ab3aaa)
7711c0
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
7711c0
---
7711c0
 migration/migration.c | 6 +++++-
7711c0
 1 file changed, 5 insertions(+), 1 deletion(-)
7711c0
7711c0
diff --git a/migration/migration.c b/migration/migration.c
7711c0
index 83b8d6a..69011d1 100644
7711c0
--- a/migration/migration.c
7711c0
+++ b/migration/migration.c
7711c0
@@ -1270,7 +1270,11 @@ bool migration_in_postcopy_after_devices(MigrationState *s)
7711c0
 
7711c0
 bool migration_is_idle(void)
7711c0
 {
7711c0
-    MigrationState *s = migrate_get_current();
7711c0
+    MigrationState *s = current_migration;
7711c0
+
7711c0
+    if (!s) {
7711c0
+        return true;
7711c0
+    }
7711c0
 
7711c0
     switch (s->state) {
7711c0
     case MIGRATION_STATUS_NONE:
7711c0
-- 
7711c0
1.8.3.1
7711c0