Re: [PATCH] mm/shmem: add support for FS_IOC_[SG]ETFLAGS for tmpfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 13 Jul 2022 10:52:34 -0400 "Theodore Ts'o" <tytso@xxxxxxx> wrote:

> This allows userspace to set flags like FS_APPEND_FL, FS_IMMUTABLE_FL,
> FS_NODUMP_FL, etc., like all other standard Linux file systems.
> 
> ...
>
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -28,6 +28,7 @@
>  #include <linux/ramfs.h>
>  #include <linux/pagemap.h>
>  #include <linux/file.h>
> +#include <linux/fileattr.h>
>  #include <linux/mm.h>
>  #include <linux/random.h>
>  #include <linux/sched/signal.h>
> @@ -1058,6 +1059,15 @@ static int shmem_getattr(struct user_namespace *mnt_userns,
>  		shmem_recalc_inode(inode);
>  		spin_unlock_irq(&info->lock);
>  	}
> +	if (info->fsflags & EXT2_APPEND_FL)
> +		stat->attributes |= STATX_ATTR_APPEND;
> +	if (info->fsflags & EXT2_IMMUTABLE_FL)
> +		stat->attributes |= STATX_ATTR_IMMUTABLE;
> +	if (info->fsflags & EXT2_NODUMP_FL)
> +		stat->attributes |= STATX_ATTR_NODUMP;
> +	stat->attributes_mask |= (STATX_ATTR_APPEND |
> +			STATX_ATTR_IMMUTABLE |
> +			STATX_ATTR_NODUMP);
>  	generic_fillattr(&init_user_ns, inode, stat);
>  
>  	if (shmem_is_huge(NULL, inode, 0))

hm, how did you even test this?

mm/shmem.c: In function 'shmem_getattr':
mm/shmem.c:1062:29: error: 'EXT2_APPEND_FL' undeclared (first use in this function); did you mean 'FS_APPEND_FL'?
 1062 |         if (info->fsflags & EXT2_APPEND_FL)
      |                             ^~~~~~~~~~~~~~
      |                             FS_APPEND_FL


this

--- a/mm/shmem.c~mm-shmem-add-support-for-fs_ioc_etflags-for-tmpfs-fix-2
+++ a/mm/shmem.c
@@ -40,6 +40,8 @@
 #include <linux/swapfile.h>
 #include "swap.h"
 
+#include <../fs/ext2/ext2.h>
+
 static struct vfsmount *shm_mnt;
 
 #ifdef CONFIG_SHMEM

seems quite wrong.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux