]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: migration: Don't access disk members without lock
authorPeter Krempa <pkrempa@redhat.com>
Fri, 23 Feb 2018 08:03:49 +0000 (09:03 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Wed, 23 May 2018 11:18:23 +0000 (13:18 +0200)
The initiation of a synchronous block job in the NBD storage migration
code was placed after entering the monitor thus after the lock on the VM
object was unlocked. Thankfully nothing bad could happen in this
situation since the migration job prevents any disk detaches or other
modifications of the domain object.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_migration.c

index f753e42d1bd28e1791cceb21c3cbadf49a904176..5fa2b4b56be871ef585f5b9cbf8af9a43850f64c 100644 (file)
@@ -833,11 +833,12 @@ qemuMigrationSrcDriveMirror(virQEMUDriverPtr driver,
                          hoststr, port, diskAlias) < 0))
             goto cleanup;
 
+        qemuBlockJobSyncBegin(disk);
+
         if (qemuDomainObjEnterMonitorAsync(driver, vm,
                                            QEMU_ASYNC_JOB_MIGRATION_OUT) < 0)
             goto cleanup;
 
-        qemuBlockJobSyncBegin(disk);
         /* Force "raw" format for NBD export */
         mon_ret = qemuMonitorDriveMirror(priv->mon, diskAlias, nbd_dest,
                                          "raw", mirror_speed, 0, 0, mirror_flags);