linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hughd@google.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Christoph Hellwig <hch@infradead.org>,
	Andi Kleen <andi@firstfloor.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/10] tmpfs: enable NOSEC optimization
Date: Mon, 14 May 2012 12:48:16 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LSU.2.00.1205141242530.1623@eggly.anvils> (raw)
In-Reply-To: <4FB0D1C6.7090801@gmail.com>

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@google.com>
> > ---
> >   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@kvack.org.  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@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2012-05-14 19:48 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-12 11:52 [PATCH 0/10] shmem/tmpfs: misc and fallocate Hugh Dickins
2012-05-12 11:59 ` [PATCH 1/10] shmem: replace page if mapping excludes its zone Hugh Dickins
2012-05-14  8:55   ` Cong Wang
2012-05-14 19:42     ` Hugh Dickins
2012-05-15  9:44       ` Cong Wang
2012-05-14  9:06   ` KAMEZAWA Hiroyuki
2012-05-14 23:13   ` Andrew Morton
2012-05-15  4:07     ` Hugh Dickins
2012-05-19  1:41       ` Hugh Dickins
2012-05-19  1:44         ` [PATCH v2 1/10] shmem: substitute " Hugh Dickins
2012-05-12 12:02 ` [PATCH 2/10] tmpfs: enable NOSEC optimization Hugh Dickins
2012-05-14  9:35   ` Cong Wang
2012-05-14 19:48     ` Hugh Dickins [this message]
2012-05-12 12:04 ` [PATCH 3/10] tmpfs: optimize clearing when writing Hugh Dickins
2012-05-15  8:51   ` Nick Piggin
2012-05-12 12:05 ` [PATCH 4/10] tmpfs: support fallocate FALLOC_FL_PUNCH_HOLE Hugh Dickins
2012-05-12 12:13 ` [PATCH 5/10] mm/fs: route MADV_REMOVE to FALLOC_FL_PUNCH_HOLE Hugh Dickins
2012-05-22  0:08   ` john stultz
2012-05-22 15:11     ` Hugh Dickins
2012-05-12 12:15 ` [PATCH 6/10] mm/fs: remove truncate_range Hugh Dickins
2012-05-12 12:17 ` [PATCH 7/10] tmpfs: support fallocate preallocation Hugh Dickins
2012-05-12 12:19 ` [PATCH 8/10] tmpfs: undo fallocation on failure Hugh Dickins
2012-05-12 12:21 ` [PATCH 9/10] tmpfs: quit when fallocate fills memory Hugh Dickins
2012-05-12 12:27 ` [PATCH 10/10] tmpfs: support SEEK_DATA and SEEK_HOLE Hugh Dickins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LSU.2.00.1205141242530.1623@eggly.anvils \
    --to=hughd@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=hch@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox