• Amir Goldstein's avatar
    ovl: consistent behavior for immutable/append-only inodes · 096a218a
    Amir Goldstein authored
    When a lower file has immutable/append-only fileattr flags, the behavior of
    overlayfs post copy up is inconsistent.
    
    Immediattely after copy up, ovl inode still has the S_IMMUTABLE/S_APPEND
    inode flags copied from lower inode, so vfs code still treats the ovl inode
    as immutable/append-only.  After ovl inode evict or mount cycle, the ovl
    inode does not have these inode flags anymore.
    
    We cannot copy up the immutable and append-only fileattr flags, because
    immutable/append-only inodes cannot be linked and because overlayfs will
    not be able to set overlay.* xattr on the upper inodes.
    
    Instead, if any of the fileattr flags of interest exist on the lower inode,
    we store them in overlay.protattr xattr on the upper inode and we read the
    flags from xattr on lookup and on fileattr_get().
    
    This gives consistent behavior post copy up regardless of inode eviction
    from cache.
    
    When user sets new fileattr flags, we update or remove the overlay.protattr
    xattr.
    
    S...
    096a218a
overlayfs.h 19.7 KB