Re: [PATCH 2/10] tmpfs: enable NOSEC optimization

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

 



On Mon, 14 May 2012, Cong Wang wrote:
> On 05/12/2012 08:02 PM, Hugh Dickins wrote:
> > Let tmpfs into the NOSEC optimization (avoiding file_remove_suid()
> > overhead on most common writes): set MS_NOSEC on its superblocks.
> > 
> > Signed-off-by: Hugh Dickins<hughd@xxxxxxxxxx>
> > ---
> >   mm/shmem.c |    1 +
> >   1 file changed, 1 insertion(+)
> > 
> > --- 3045N.orig/mm/shmem.c	2012-05-05 10:45:17.888060878 -0700
> > +++ 3045N/mm/shmem.c	2012-05-05 10:46:05.732062006 -0700
> > @@ -2361,6 +2361,7 @@ int shmem_fill_super(struct super_block
> >   		}
> >   	}
> >   	sb->s_export_op =&shmem_export_ops;
> > +	sb->s_flags |= MS_NOSEC;
> 
> Isn't setting the flag on inode better? Something like:

I don't think so.  The MS_NOSEC S_NOSEC business is fairly subtle,
and easy to miss if it's gone wrong, so I would much rather follow
the established pattern in local block filesystems: which is to set
MS_NOSEC in superblock flags, and leave S_NOSEC to file_remove_suid().

Hugh

> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index f99ff3e..7d98fb5 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2325,6 +2325,7 @@ static void shmem_init_inode(void *foo)
>  {
>         struct shmem_inode_info *info = foo;
>         inode_init_once(&info->vfs_inode);
> +       info->vfs_inode.i_flags |= S_NOSEC;
>  }
> 
>  static int shmem_init_inodecache(void)

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


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