]> git.ipfire.org Git - thirdparty/lxc.git/commit
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>
Fri, 28 Aug 2015 22:02:15 +0000 (18:02 -0400)
commit6147fe2e157cf9928a053efdd8027445e3d57507
tree1fb1b09adcdd70fe3ac7cbf32e2b1b59e46cb040
parentda2cac4003d2049492a8cf0970ca59f0c710b0a9
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