• Hugh Dickins's avatar
    mm/shmem: fix chattr fsflags support in tmpfs · cb241339
    Hugh Dickins authored
    ext[234] have always allowed unimplemented chattr flags to be set, but
    other filesystems have tended to be stricter.  Follow the stricter
    approach for tmpfs: I don't want to have to explain why csu attributes
    don't actually work, and we won't need to update the chattr(1) manpage;
    and it's never wrong to start off strict, relaxing later if persuaded. 
    Allow only a (append only) i (immutable) A (no atime) and d (no dump).
    
    Although lsattr showed 'A' inherited, the NOATIME behavior was not being
    inherited: because nothing sync'ed FS_NOATIME_FL to S_NOATIME.  Add
    shmem_set_inode_flags() to sync the flags, using inode_set_flags() to
    avoid that instant of lost immutablility during fileattr_set().
    
    But that change switched generic/079 from passing to failing: because
    FS_IMMUTABLE_FL and FS_APPEND_FL had been unconventionally included in the
    INHERITED fsflags: remove them and generic/079 is back to passing.
    
    Link: https://lkml.kernel.org/r/2961dcb0-ddf3-b9f0-3268-12a4ff996856@google.com
    Fixes: e408e695 ("mm/shmem: support FS_IOC_[SG]ETFLAGS in tmpfs")
    Signed-off-by: default avatarHugh Dickins <hughd@google.com>
    Cc: "Theodore Ts'o" <tytso@mit.edu>
    Cc: Radoslaw Burny <rburny@google.com>
    Cc: "Darrick J. Wong" <djwong@kernel.org>
    Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    cb241339
shmem.c 110 KB