On Tue 04-11-14 12:20:26, Jan Beulich wrote: > >>> On 04.11.14 at 12:43, <"jack@xxxxxxx".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@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html