On Tue, Sep 27, 2016 at 06:43:35PM +0200, Jan Kara wrote: > Currently each filesystem (possibly through generic_file_direct_write() > or iomap_dax_rw()) takes care of invalidating page tables and evicting > hole pages from the radix tree when write(2) to the file happens. This > invalidation is only necessary when there is some block allocation > resulting from write(2). Furthermore in current place the invalidation > is racy wrt page fault instantiating a hole page just after we have > invalidated it. > > So perform the page invalidation inside dax_do_io() where we can do it > only when really necessary and after blocks have been allocated so > nobody will be instantiating new hole pages anymore. > > Signed-off-by: Jan Kara <jack@xxxxxxx> This looks fine with the comment from Dave addressed: Reviewed-by: Christoph Hellwig <hch@xxxxxx> > + if (buffer_new(bh) && > + inode->i_mapping->nrpages) { Btw, it would be nice if the nrpages check could move into invalidate_inode_pages2_range instead of having to bother with it in the callers. -- 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