Re: [PATCH 5/6] libxl: Fix removing non-persistent domain after save

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 21, 2013 at 12:22:23PM -0700, Jim Fehlig wrote:
> libxlDoDomainSave() was removing non-persistent domains, but
> required callers to have the virDomainObj locked.  Callers could
> potentially unlock an already freed virDomainObj.  Move this
> logic to the callers of libxlDoDomainSave().
> ---
>  src/libxl/libxl_driver.c | 26 ++++++++++++++++++--------
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
> index 08dffd6..7484b83 100644
> --- a/src/libxl/libxl_driver.c
> +++ b/src/libxl/libxl_driver.c
> @@ -2118,12 +2118,6 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
>      }
>  
>      vm->hasManagedSave = true;
> -
> -    if (!vm->persistent) {
> -        virDomainRemoveInactive(&driver->domains, vm);
> -        vm = NULL;
> -    }
> -
>      ret = 0;
>  
>  cleanup:
> @@ -2166,7 +2160,15 @@ libxlDomainSaveFlags(virDomainPtr dom, const char *to, const char *dxml,
>          goto cleanup;
>      }
>  
> -    ret = libxlDoDomainSave(driver, vm, to);
> +    if (libxlDoDomainSave(driver, vm, to) < 0)
> +        goto cleanup;
> +
> +    if (!vm->persistent) {
> +        virDomainRemoveInactive(&driver->domains, vm);
> +        vm = NULL;
> +    }
> +
> +    ret = 0;
>  
>  cleanup:
>      if (vm)
> @@ -2365,7 +2367,15 @@ libxlDomainManagedSave(virDomainPtr dom, unsigned int flags)
>  
>      VIR_INFO("Saving state to %s", name);
>  
> -    ret = libxlDoDomainSave(driver, vm, name);
> +    if (libxlDoDomainSave(driver, vm, name) < 0)
> +        goto cleanup;
> +
> +    if (!vm->persistent) {
> +        virDomainRemoveInactive(&driver->domains, vm);
> +        vm = NULL;
> +    }
> +
> +    ret = 0;
>  
>  cleanup:
>      if (vm)

  ACK,

Daniel

-- 
Daniel Veillard      | Open Source and Standards, Red Hat
veillard@xxxxxxxxxx  | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | virtualization library  http://libvirt.org/

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]