Re: [PATCH 10/11] Fix vm usage after ExitMonitor in qemu migration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16.12.2014 17:41, Ján Tomko wrote:
It should not be needed in all qemuMigrationSet* functions,
but I changed them all for consistency.
---
  src/qemu/qemu_migration.c | 41 ++++++++++++++++++++++++++---------------
  1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 0acbb57..ed7d6fe 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1662,7 +1662,8 @@ qemuMigrationStartNBDServer(virQEMUDriverPtr driver,
              qemuDomainObjExitMonitor(driver, vm);
              goto cleanup;
          }
-        qemuDomainObjExitMonitor(driver, vm);
+        if (qemuDomainObjExitMonitorAlive(driver, vm) < 0)
+            goto cleanup;
      }

      priv->nbdPort = port;
@@ -1859,7 +1860,7 @@ qemuMigrationDriveMirror(virQEMUDriverPtr driver,
  }


-static void
+static int
  qemuMigrationStopNBDServer(virQEMUDriverPtr driver,
                             virDomainObjPtr vm,
                             qemuMigrationCookiePtr mig)
@@ -1867,22 +1868,23 @@ qemuMigrationStopNBDServer(virQEMUDriverPtr driver,
      qemuDomainObjPrivatePtr priv = vm->privateData;

      if (!mig->nbd)
-        return;
+        return 0;

      if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                         QEMU_ASYNC_JOB_MIGRATION_IN) < 0)
-        return;
+        return -1;

      if (qemuMonitorNBDServerStop(priv->mon) < 0)
          VIR_WARN("Unable to stop NBD server");

-    qemuDomainObjExitMonitor(driver, vm);
-
      virPortAllocatorRelease(driver->migrationPorts, priv->nbdPort);
      priv->nbdPort = 0;
+    if (qemuDomainObjExitMonitorAlive(driver, vm) < 0)
+        return -1;

I don't thin it's safe to manipulate priv with unlocked domain. Otherwise looking good.

+    return 0;
  }


Michal

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]