Speaking about ubuntu 22.04 with the hwe kernel and "overlayroot" package 
installed.

Say I've got such fstab:

    /dev/sda3 / ext4 errors=remount-ro 0 1
    /dev/sdb1 /nas xfs defaults 0 2

When booting I append "overlayroot=tmpfs" to the kernel cmdline in grub. It 
gives me such overlay
mounts:

    overlayroot / overlay 
rw,relatime,lowerdir=/media/root-ro,upperdir=/media/root-rw/overlay,workdir=/media/root-rw/overlay-workdir/_,nouserxattr
 0 0
    /media/root-ro/nas /nas overlay 
rw,relatime,lowerdir=/media/root-ro/nas,upperdir=/media/root-rw/overlay/nas,workdir=/media/root-rw/overlay-workdir/nas,nouserxattr
 0 0

With that I get a warning in the kernel log:

    kernel: overlayfs: upperdir is in-use as upperdir/workdir of another mount, 
accessing files
    from both mounts will result in undefined behavior.

The warning is caused by the fact the second overlay's upperdir 
(/media/root-rw/overlay/nas) is a
subdir of the first overlay's upperdir /media/root-rw/overlay).

Interestingly, there is no such thing for workdir: 
/media/root-rw/overlay-workdir/nas vs
/media/root-rw/overlay-workdir/_ [1]

Overall it likely works, but I wonder: why overlayroot uses a dedicated subdir 
("_") of
/media/root-rw/overlay-workdir for root's workdir, but is fuses things together 
for upperdirs? If
only the root's upperdir was /media/root-rw/overlay/_, it would be much cleaner 
and without
warnings.


[1] Introduced under title "get workdir set right" in
https://git.launchpad.net/cloud-initramfs-tools/commit/?id=def357d70848ca10b51a6ce795e6e94c3e13c9d5


-- 
Ubuntu-devel-discuss mailing list
Ubuntu-devel-discuss@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss

Reply via email to