[libvirt] [PATCH] libxl: Drop driver lock in libxlDomainDefineXML
Michal Privoznik
mprivozn at redhat.com
Fri Sep 19 07:27:12 UTC 2014
On 18.09.2014 23:17, Jim Fehlig wrote:
> 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.
>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
> src/libxl/libxl_driver.c | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 2f2c590..d4ecd62 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -2381,25 +2381,22 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
> 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) {
> @@ -2426,10 +2423,6 @@ libxlDomainDefineXML(virConnectPtr conn, const char *xml)
> libxlDomainEventQueue(driver, event);
> virObjectUnref(cfg);
> return dom;
> -
> - cleanup_unlock:
> - libxlDriverUnlock(driver);
> - goto cleanup;
> }
>
> static int
>
ACK
Michal
More information about the libvir-list
mailing list