From: Jan Kara <jack@suse.cz>
To: Jan Beulich <JBeulich@suse.com>
Cc: Jan Kara <jack@suse.cz>, Dave Chinner <david@fromorbit.com>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] mm: Improve comment before pagecache_isize_extended()
Date: Tue, 4 Nov 2014 16:33:43 +0100 [thread overview]
Message-ID: <20141104153343.GA21902@quack.suse.cz> (raw)
In-Reply-To: <5458D29A0200007800044C76@mail.emea.novell.com>
On Tue 04-11-14 12:20:26, Jan Beulich wrote:
> >>> On 04.11.14 at 12:43, <"jack@suse.cz".non-mime.internet> wrote:
> > --- a/mm/truncate.c
> > +++ b/mm/truncate.c
> > @@ -743,10 +743,13 @@ EXPORT_SYMBOL(truncate_setsize);
> > * changed.
> > *
> > * The function must be called after i_size is updated so that page fault
> > - * coming after we unlock the page will already see the new i_size.
> > - * The function must be called while we still hold i_mutex - this not only
> > - * makes sure i_size is stable but also that userspace cannot observe new
> > - * i_size value before we are prepared to store mmap writes at new inode size.
> > + * coming after we unlock the page will already see the new i_size. The caller
> > + * must make sure (generally by holding i_mutex but e.g. XFS uses its private
> > + * lock) i_size cannot change from the new value while we are called. It must
> > + * also make sure userspace cannot observe new i_size value before we are
> > + * prepared to store mmap writes upto new inode size (otherwise userspace could
> > + * think it stored data via mmap within i_size but they would get zeroed due to
> > + * writeback & reclaim because they have no backing blocks).
> > */
> > void pagecache_isize_extended(struct inode *inode, loff_t from, loff_t to)
> > {
>
> May I suggest that the comment preceding truncate_setsize() also be
> updated/removed?
But that comment is actually still true AFAICT because VFS takes i_mutex
before calling into ->setattr(). So we hold i_mutex in truncate_setsize()
even for XFS.
Honza
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
--
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/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-11-04 15:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-04 11:43 [PATCH] mm: Improve comment before pagecache_isize_extended() Jan Kara
2014-11-04 12:20 ` Jan Beulich
2014-11-04 15:33 ` Jan Kara [this message]
2014-11-04 16:20 ` Jan Beulich
2014-11-04 19:37 ` Jan Kara
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=20141104153343.GA21902@quack.suse.cz \
--to=jack@suse.cz \
--cc=JBeulich@suse.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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;
as well as URLs for NNTP newsgroup(s).