Re: [PATCH] lxc: Fix virLXCDomainObjBeginJob position in lxcDomainSetMemoryParameters

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

 



On 27.05.2016 11:23, Katerina Koukiou wrote:
> Adjust the code to perform the virLXCDomainObjBeginJob first
> and then the call virDomainLiveConfigHelperMethod.
> As Ján Tomko pointed out, in virDomainLiveConfigHelperMethod,
> there is a check to see if the domain is active when AFFECT_LIVE is set.
> Since virLXCDomainObjBeginJob unlocks the virDomainObjPtr lock,
> the domain could possibly be destroyed while we wait for the job
> and the check results would no longer be valid.
> 
> Signed-off-by: Katerina Koukiou <k.koukiou@xxxxxxxxx>
> ---
>  src/lxc/lxc_driver.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
> index 3aadd64..f883ffb 100644
> --- a/src/lxc/lxc_driver.c
> +++ b/src/lxc/lxc_driver.c
> @@ -841,14 +841,16 @@ lxcDomainSetMemoryParameters(virDomainPtr dom,
>      cfg = virLXCDriverGetConfig(driver);
>  
>      if (virDomainSetMemoryParametersEnsureACL(dom->conn, vm->def, flags) < 0 ||
> -        !(caps = virLXCDriverGetCapabilities(driver, false)) ||
> -        virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
> -                                        vm, &flags, &vmdef) < 0)
> +        !(caps = virLXCDriverGetCapabilities(driver, false)))
>          goto cleanup;
>  
>      if (virLXCDomainObjBeginJob(driver, vm, LXC_JOB_MODIFY) < 0)
>          goto cleanup;
>  
> +    if (virDomainLiveConfigHelperMethod(caps, driver->xmlopt,
> +                                        vm, &flags, &vmdef) < 0)
> +        goto endjob;
> +
>      if (flags & VIR_DOMAIN_AFFECT_LIVE &&
>          !virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_MEMORY)) {
>          virReportError(VIR_ERR_OPERATION_INVALID,
> 

ACKed and pushed.

Michal

--
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]