diff --git a/mm/filemap.c b/mm/filemap.c index 5bf4645256cbcafc30e306f2927f0068957e9a3c..ecf8bed4c76f2d51d0cca2134f5846d8ae34976d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2273,6 +2273,15 @@ static ssize_t generic_file_buffered_read(struct kiocb *iocb, } nr = nr - offset; + /* + * Pairs with a barrier in + * block_write_end()->mark_buffer_dirty() or other page + * dirtying routines like iomap_write_end() to ensure + * changes to page contents are visible before we see + * increased inode size. + */ + smp_rmb(); + /* If users can be writing to this page using arbitrary * virtual addresses, take care about potential aliasing * before reading the page on the kernel side.