Re: [PATCH 2/2] lxc: Clean up /.oldroot

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

 



On Sun, Apr 15, 2018 at 04:30:11PM +0100, Radostin Stoyanov wrote:
> Remove the /.oldroot directory after it has been unmounted (at the end
> of lxcContainerSetupPivotRoot). Ignore errors silently.
> 
> Signed-off-by: Radostin Stoyanov <rstoyanov1@xxxxxxxxx>
> ---
>  src/lxc/lxc_container.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
> index 665b93a0a..dd4e38703 100644
> --- a/src/lxc/lxc_container.c
> +++ b/src/lxc/lxc_container.c
> @@ -1811,6 +1811,9 @@ static int lxcContainerSetupPivotRoot(virDomainDefPtr vmDef,
>      if (lxcContainerUnmountSubtree("/.oldroot", true) < 0)
>          goto cleanup;
>  
> +    if (virFileRemove("/.oldroot", 0, 0) < 0)
> +        VIR_DEBUG("Failed to remove /.oldroot after start");
> +

I think this introduces a race condition. There can be two containers
with the same root filesystem. If we start both at the same time, then
this deletion of /.oldroot can cause the other contanier to fail to
start if it saw that /.oldroot already existed & it thus tried to skip
mkdir.

Leaving the empty directory is harmless IMHO

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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

  Powered by Linux