[libvirt] [PATCH] libxl: remove unneeded locking of driver when restoring

Michal Privoznik mprivozn at redhat.com
Thu Feb 6 17:51:24 UTC 2014


On 06.02.2014 18:46, Jim Fehlig wrote:
> libxlDomainRestoreFlags acquires the driver lock while reading the
> domain config from the save file and adding it to
> libxlDriverPrivatePtr->domains.  But virDomainObjList provides
> self-locking APIs, so remove the needless driver locking.
>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
>
> I noticed this while working on the recent series to improve event handling
> in the libxl driver, but it got lost when I reshuffled the patches a bit
> before sending to the list.
>
>   src/libxl/libxl_driver.c | 6 ------
>   1 file changed, 6 deletions(-)
>
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index b852279..03aa463 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -1956,11 +1956,6 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
>           return -1;
>       }
>
> -    /* Lock the driver until domain def is read from the saved
> -       image and a virDomainObj is created and locked.
> -    */
> -    libxlDriverLock(driver);
> -
>       fd = libxlSaveImageOpen(driver, cfg, from, &def, &hdr);
>       if (fd < 0)
>           goto cleanup_unlock;
> @@ -1975,7 +1970,6 @@ libxlDomainRestoreFlags(virConnectPtr conn, const char *from,
>                                      NULL)))
>           goto cleanup_unlock;
>
> -    libxlDriverUnlock(driver);
>       def = NULL;
>
>       ret = libxlVmStart(driver, vm, (flags & VIR_DOMAIN_SAVE_PAUSED) != 0, fd);
>

Right, this locking is not necessary. ACK

Michal




More information about the libvir-list mailing list