]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/utils.c
lxc-destroy: actually work if underlying fs is overlayfs
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Mon, 16 Mar 2015 17:02:12 +0000 (17:02 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 6 Apr 2015 16:12:10 +0000 (12:12 -0400)
commit0cc417b20f5cc48e99e5052cde05ed85beae636e
treea586dbc2a4249aca9216bbba66da53764f4e0cc0
parent7b7d76e00be2c37e073d7c76ebe8b8bbff3e914f
lxc-destroy: actually work if underlying fs is overlayfs

One of the 'features' of overlayfs is that depending on whether a file
is on the upper or lower dir you get back a different device from stat.
That breaks our lxc_rmdir_onedev.

So at lxc_rmdir_ondev check the device of the directory being deleted.
If it is overlayfs, then skip the device check.

Note this is unrelated to overlayfs snapshots - in those cases when you
delete a container, /var/lib/lxc/$container/ does not actually have an
overlayfs under it.  Rather, to reproduce this you would

sudo mkdir /opt/{lower,upper,workdir}
sudo mount -t overlayfs -o lower=/opt/lower,upper=/opt/upper,workdir=/opt/workdir \
lxc /var/lib/lxc
sudo lxc-create -t download -n c1 -- -d ubuntu -r trusty -a amd64
sudo lxc-destroy -n c1

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Tested-by: Marko Ratkaj <marko.ratkaj@sartura.hr>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/utils.c