• Pavel Tikhomirov's avatar
    ovl: introduce new "uuid=off" option for inodes index feature · 5830fb6b
    Pavel Tikhomirov authored
    This replaces uuid with null in overlayfs file handles and thus relaxes
    uuid checks for overlay index feature. It is only possible in case there is
    only one filesystem for all the work/upper/lower directories and bare file
    handles from this backing filesystem are unique. In other case when we have
    multiple filesystems lets just fallback to "uuid=on" which is and
    equivalent of how it worked before with all uuid checks.
    
    This is needed when overlayfs is/was mounted in a container with index
    enabled (e.g.: to be able to resolve inotify watch file handles on it to
    paths in CRIU), and this container is copied and started alongside with the
    original one. This way the "copy" container can't have the same uuid on the
    superblock and mounting the overlayfs from it later would fail.
    
    That is an example of the problem on top of loop+ext4:
    
    dd if=/dev/zero of=loopbackfile.img bs=100M count=10
    losetup -fP loopbackfile.img
    losetup -a
      #/dev/loop0: [64768]:35 (/loop-test/loopbackfile.img)
    mkfs.ext4 loopbackfile.img
    mkdir loop-mp
    mount -o loop /dev/loop0 loop-mp
    mkdir loop-mp/{lower,upper,work,merged}
    mount -t overlay overlay -oindex=on,lowerdir=loop-mp/lower,\
    upperdir=loop-mp/upper,workdir=loop-mp/work loop-mp/merged
    umount loop-mp/merged
    umount loop-mp
    e2fsck -f /dev/loop0
    tune2fs -U random /dev/loop0
    
    mount -o loop /dev/loop0 loop-mp
    mount -t overlay overlay -oindex=on,lowerdir=loop-mp/lower,\
    upperdir=loop-mp/upper,workdir=loop-mp/work loop-mp/merged
      #mount: /loop-test/loop-mp/merged:
      #mount(2) system call failed: Stale file handle.
    
    If you just change the uuid of the backing filesystem, overlay is not
    mounting any more. In Virtuozzo we copy container disks (ploops) when
    create the copy of container and we require fs uuid to be unique for a new
    container.
    Signed-off-by: default avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
    Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    5830fb6b
ovl_entry.h 3.24 KB