Restarting containers not possible with recursive mounted directories?


(Idef1x) #1

I have a few containers having the same (if relevant) recursive mounted host directory in the container. I use recursive since the sub directories are all sub ZFS datasets, so can't be mounted otherwise at once.

Host directory layout:
/data/LXD-TEST
/data/LXD-TEST/SUBDIR-1
/data/LXD-TEST/SUBDIR-3
/data/LXD-TEST/SUBDIR-3

I've 3 containers (test1, test2 and test3). Test1 mounts all directories as non recursive directories. Test2 and test3 mounts data/LXD-TEST recursively (recursive=yes)

In all subdirectories I have a file.

When I stop test1 (the non recursive one) and start it just works fine.
However with a recursively mounted container (test2 for example), I can stop it just fine, but when I want to start it again it fails due to:

lxc start test2
error: remove /var/lib/lxd/devices/test2/disk.LXD-TEST: device or resource busy
Try lxc info --show-log test2 for more info

More info gives:
root@asterix:/# lxc info --show-log test2
Name: test2
Remote: unix://
Architecture: x86_64
Created: 2017/12/05 13:41 UTC
Status: Stopped
Type: persistent
Profiles: default

Log:

        lxc 20171205134202.779 WARN     lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
        lxc 20171205134202.779 WARN     lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
        lxc 20171205134203.237 WARN     lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
        lxc 20171205134203.237 WARN     lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
        lxc 20171205134336.826 WARN     lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
        lxc 20171205134336.857 WARN     lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
        lxc 20171205134336.985 WARN     lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.

Looks like the subdirs are still mounted, so can't mount them again (I guess that's what LXD tries to do):
root@asterix:/# mount |grep test2
/data/LXD-TEST on /data/asterix/lxd/devices/test2/disk.LXD-TEST type zfs (rw,noatime,xattr,noacl)
/data/LXD-TEST/SUBDIR-1 on /data/asterix/lxd/devices/test2/disk.LXD-TEST/SUBDIR-1 type zfs (rw,noatime,xattr,noacl)
/data/LXD-TEST/SUBDIR-2 on /data/asterix/lxd/devices/test2/disk.LXD-TEST/SUBDIR-2 type zfs (rw,noatime,xattr,noacl)
/data/LXD-TEST/SUBDIR-3 on /data/asterix/lxd/devices/test2/disk.LXD-TEST/SUBDIR-3 type zfs (rw,noatime,xattr,noacl)

When I then umount all the subdirs manually referencing to test2, I'll loose the contents of these directories in the other containers having these subdirs mounted (cause you actually unmount the whole ZFS dataset)

So I guess something might be wrong with unmounting recursively mounted host paths..Can someone confirm this or shall I open a github issue?

Sorry forgot to add to mention that this is with LXD 2.20 on Ubuntu 16.0.4 LTS (updated)