File c7892373-libxl-remove-lock.patch of Package libvirt
commit c78923732d2067ec5d6e9b3fd82e4e3a1592df92
Author: Jim Fehlig <jfehlig@suse.com>
Date: Thu Sep 18 15:05:34 2014 -0600
libxl: Drop driver lock in libxlDomainDefineXML
There is no need to acquire the driver-wide lock in
libxlDomainDefineXML. When switching to jobs in the libxl
driver, most driver-wide locks were removed. The locking here
was preserved since I mistakenly thought virDomainObjListAdd
needed protection. This is not the case, so remove the
unnecessary locking.
Index: libvirt-1.2.5/src/libxl/libxl_driver.c
===================================================================
--- libvirt-1.2.5.orig/src/libxl/libxl_driver.c
+++ libvirt-1.2.5/src/libxl/libxl_driver.c
@@ -2385,25 +2385,22 @@ libxlDomainDefineXML(virConnectPtr conn,
virObjectEventPtr event = NULL;
virDomainDefPtr oldDef = NULL;
- /* Lock the driver until the virDomainObj is created and locked */
- libxlDriverLock(driver);
if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt,
1 << VIR_DOMAIN_VIRT_XEN,
VIR_DOMAIN_XML_INACTIVE)))
- goto cleanup_unlock;
+ goto cleanup;
if (virDomainDefineXMLEnsureACL(conn, def) < 0)
- goto cleanup_unlock;
+ goto cleanup;
if (!(vm = virDomainObjListAdd(driver->domains, def,
driver->xmlopt,
0,
&oldDef)))
- goto cleanup_unlock;
+ goto cleanup;
def = NULL;
vm->persistent = 1;
- libxlDriverUnlock(driver);
if (virDomainSaveConfig(cfg->configDir,
vm->newDef ? vm->newDef : vm->def) < 0) {
@@ -2430,10 +2427,6 @@ libxlDomainDefineXML(virConnectPtr conn,
libxlDomainEventQueue(driver, event);
virObjectUnref(cfg);
return dom;
-
- cleanup_unlock:
- libxlDriverUnlock(driver);
- goto cleanup;
}
static int