提交 c7892373 编写于 作者: J Jim Fehlig

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.
上级 74eaa091
...@@ -2381,25 +2381,22 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml) ...@@ -2381,25 +2381,22 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
virObjectEventPtr event = NULL; virObjectEventPtr event = NULL;
virDomainDefPtr oldDef = NULL; virDomainDefPtr oldDef = NULL;
/* Lock the driver until the virDomainObj is created and locked */
libxlDriverLock(driver);
if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt, if (!(def = virDomainDefParseString(xml, cfg->caps, driver->xmlopt,
1 << VIR_DOMAIN_VIRT_XEN, 1 << VIR_DOMAIN_VIRT_XEN,
VIR_DOMAIN_XML_INACTIVE))) VIR_DOMAIN_XML_INACTIVE)))
goto cleanup_unlock; goto cleanup;
if (virDomainDefineXMLEnsureACL(conn, def) < 0) if (virDomainDefineXMLEnsureACL(conn, def) < 0)
goto cleanup_unlock; goto cleanup;
if (!(vm = virDomainObjListAdd(driver->domains, def, if (!(vm = virDomainObjListAdd(driver->domains, def,
driver->xmlopt, driver->xmlopt,
0, 0,
&oldDef))) &oldDef)))
goto cleanup_unlock; goto cleanup;
def = NULL; def = NULL;
vm->persistent = 1; vm->persistent = 1;
libxlDriverUnlock(driver);
if (virDomainSaveConfig(cfg->configDir, if (virDomainSaveConfig(cfg->configDir,
vm->newDef ? vm->newDef : vm->def) < 0) { vm->newDef ? vm->newDef : vm->def) < 0) {
...@@ -2426,10 +2423,6 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml) ...@@ -2426,10 +2423,6 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
libxlDomainEventQueue(driver, event); libxlDomainEventQueue(driver, event);
virObjectUnref(cfg); virObjectUnref(cfg);
return dom; return dom;
cleanup_unlock:
libxlDriverUnlock(driver);
goto cleanup;
} }
static int static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册