The patch titled Subject: mm-shmem-support-fs_ioc_etflags-in-tmpfs-fix has been added to the -mm mm-nonmm-unstable branch. Its filename is mm-shmem-support-fs_ioc_etflags-in-tmpfs-fix.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-shmem-support-fs_ioc_etflags-in-tmpfs-fix.patch This patch will later appear in the mm-nonmm-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Subject: mm-shmem-support-fs_ioc_etflags-in-tmpfs-fix Date: Mon Jul 18 03:51:33 PM PDT 2022 fix CONFIG_TMPFS_XATTR=n warnings Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Cc: "Theodore Ts'o" <tytso@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/shmem.c | 67 +++++++++++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 33 deletions(-) --- a/mm/shmem.c~mm-shmem-support-fs_ioc_etflags-in-tmpfs-fix +++ a/mm/shmem.c @@ -2837,39 +2837,6 @@ out: return error; } -static int shmem_fileattr_get(struct dentry *dentry, struct fileattr *fa) -{ - struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); - - fileattr_fill_flags(fa, info->fsflags & SHMEM_FL_USER_VISIBLE); - - return 0; -} - -static int shmem_fileattr_set(struct user_namespace *mnt_userns, - struct dentry *dentry, struct fileattr *fa) -{ - struct inode *inode = d_inode(dentry); - struct shmem_inode_info *info = SHMEM_I(inode); - - if (fileattr_has_fsx(fa)) - return -EOPNOTSUPP; - - info->fsflags = (info->fsflags & ~SHMEM_FL_USER_MODIFIABLE) | - (fa->flags & SHMEM_FL_USER_MODIFIABLE); - - inode->i_flags &= ~(S_APPEND | S_IMMUTABLE | S_NOATIME); - if (info->fsflags & FS_APPEND_FL) - inode->i_flags |= S_APPEND; - if (info->fsflags & FS_IMMUTABLE_FL) - inode->i_flags |= S_IMMUTABLE; - if (info->fsflags & FS_NOATIME_FL) - inode->i_flags |= S_NOATIME; - - inode->i_ctime = current_time(inode); - return 0; -} - static int shmem_statfs(struct dentry *dentry, struct kstatfs *buf) { struct shmem_sb_info *sbinfo = SHMEM_SB(dentry->d_sb); @@ -3195,6 +3162,40 @@ static const char *shmem_get_link(struct } #ifdef CONFIG_TMPFS_XATTR + +static int shmem_fileattr_get(struct dentry *dentry, struct fileattr *fa) +{ + struct shmem_inode_info *info = SHMEM_I(d_inode(dentry)); + + fileattr_fill_flags(fa, info->fsflags & SHMEM_FL_USER_VISIBLE); + + return 0; +} + +static int shmem_fileattr_set(struct user_namespace *mnt_userns, + struct dentry *dentry, struct fileattr *fa) +{ + struct inode *inode = d_inode(dentry); + struct shmem_inode_info *info = SHMEM_I(inode); + + if (fileattr_has_fsx(fa)) + return -EOPNOTSUPP; + + info->fsflags = (info->fsflags & ~SHMEM_FL_USER_MODIFIABLE) | + (fa->flags & SHMEM_FL_USER_MODIFIABLE); + + inode->i_flags &= ~(S_APPEND | S_IMMUTABLE | S_NOATIME); + if (info->fsflags & FS_APPEND_FL) + inode->i_flags |= S_APPEND; + if (info->fsflags & FS_IMMUTABLE_FL) + inode->i_flags |= S_IMMUTABLE; + if (info->fsflags & FS_NOATIME_FL) + inode->i_flags |= S_NOATIME; + + inode->i_ctime = current_time(inode); + return 0; +} + /* * Superblocks without xattr inode operations may get some security.* xattr * support from the LSM "for free". As soon as we have any other xattrs _ Patches currently in -mm which might be from akpm@xxxxxxxxxxxxxxxxxxxx are android-binder-stop-saving-a-pointer-to-the-vma-fix.patch mm-drop-oom-code-from-exit_mmap-fix-fix.patch mm-add-merging-after-mremap-resize-checkpatch-fixes.patch mm-shmem-support-fs_ioc_etflags-in-tmpfs-fix.patch