]> xenbits.xensource.com Git - libvirt.git/commitdiff
lxc: Fix virLXCDomainObjBeginJob position in lxcDomainSetMemoryParameters
authorKaterina Koukiou <k.koukiou@googlemail.com>
Fri, 27 May 2016 09:23:20 +0000 (12:23 +0300)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 27 May 2016 13:15:44 +0000 (15:15 +0200)
Adjust the code to perform the virLXCDomainObjBeginJob first
and then the call virDomainLiveConfigHelperMethod.
As Ján Tomko pointed out, in virDomainLiveConfigHelperMethod,
there is a check to see if the domain is active when AFFECT_LIVE is set.
Since virLXCDomainObjBeginJob unlocks the virDomainObjPtr lock,
the domain could possibly be destroyed while we wait for the job
and the check results would no longer be valid.

Signed-off-by: Katerina Koukiou <k.koukiou@gmail.com>
src/lxc/lxc_driver.c

index 9e03f1f62e06c70d211d13f9a4905778e3b28c54..67f14fe766a54f6ad8620fc65df4b1e1c29c7f38 100644 (file)
@@ -840,14 +840,16 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
     cfg = virLXCDriverGetConfig(driver);
 
     if (virDomainSetMemoryParametersEnsureACL(dom->conn, vm->def, flags) < 0 ||
-        !(caps = virLXCDriverGetCapabilities(driver, false)) ||
-        virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
-                                        vm, &flags, &vmdef) < 0)
+        !(caps = virLXCDriverGetCapabilities(driver, false)))
         goto cleanup;
 
     if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
         goto cleanup;
 
+    if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
+                                        vm, &flags, &vmdef) < 0)
+        goto endjob;
+
     if (flags & VIR_DOMAIN_AFFECT_LIVE &&
         !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
         virReportError(VIR_ERR_OPERATION_INVALID,