]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/libvirt.git/commitdiff
qemu: Warn on possibly incorrect usage of EnterMonitor*
authorJiri Denemark <jdenemar@redhat.com>
Tue, 10 Apr 2012 14:39:33 +0000 (16:39 +0200)
committerJiri Denemark <jdenemar@redhat.com>
Wed, 11 Apr 2012 07:57:39 +0000 (09:57 +0200)
qemuDomainObjEnterMonitor{,WithDriver} should not be called from async
jobs, only EnterMonitorAsync variant is allowed.

src/qemu/qemu_domain.c

index 7f1f8eef5905030a16ccb2006ee6615c75ae370e..4dda2e07447b386ebc3afa41af9a2a296feda2cf 100644 (file)
@@ -975,6 +975,9 @@ qemuDomainObjEnterMonitorInternal(struct qemud_driver *driver,
                             _("unexpected async job %d"), asyncJob);
             return -1;
         }
+        if (priv->job.asyncOwner != virThreadSelfID())
+            VIR_WARN("This thread doesn't seem to be the async job owner: %d",
+                     priv->job.asyncOwner);
         if (qemuDomainObjBeginJobInternal(driver, driver_locked, obj,
                                           QEMU_JOB_ASYNC_NESTED,
                                           QEMU_ASYNC_JOB_NONE) < 0)
@@ -986,6 +989,9 @@ qemuDomainObjEnterMonitorInternal(struct qemud_driver *driver,
             ignore_value(qemuDomainObjEndJob(driver, obj));
             return -1;
         }
+    } else if (priv->job.asyncOwner == virThreadSelfID()) {
+        VIR_WARN("This thread seems to be the async job owner; entering"
+                 " monitor without asking for a nested job is dangerous");
     }
 
     qemuMonitorLock(priv->mon);