• Alexander Larsson's avatar
    ovl: Add an alternative type of whiteout · bc8df7a3
    Alexander Larsson authored
    An xattr whiteout (called "xwhiteout" in the code) is a reguar file of
    zero size with the "overlay.whiteout" xattr set. A file like this in a
    directory with the "overlay.whiteouts" xattrs set will be treated the
    same way as a regular whiteout.
    
    The "overlay.whiteouts" directory xattr is used in order to
    efficiently handle overlay checks in readdir(), as we only need to
    checks xattrs in affected directories.
    
    The advantage of this kind of whiteout is that they can be escaped
    using the standard overlay xattr escaping mechanism. So, a file with a
    "overlay.overlay.whiteout" xattr would be unescaped to
    "overlay.whiteout", which could then be consumed by another overlayfs
    as a whiteout.
    
    Overlayfs itself doesn't create whiteouts like this, but a userspace
    mechanism could use this alternative mechanism to convert images that
    may contain whiteouts to be used with overlayfs.
    
    To work as a whiteout for both regular overlayfs mounts as well as
    userxattr mounts both the "user.overlay.whiteout*" and the
    "trusted.overlay.whiteout*" xattrs will need to be created.
    Signed-off-by: default avatarAlexander Larsson <alexl@redhat.com>
    Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    bc8df7a3
util.c 37.5 KB