On Fri, Oct 11, 2019 at 09:03:54AM -0400, Josef Bacik wrote: > --- a/fs/btrfs/inode.c > +++ b/fs/btrfs/inode.c > @@ -474,6 +474,7 @@ static noinline int compress_file_range(struct async_chunk *async_chunk) > u64 start = async_chunk->start; > u64 end = async_chunk->end; > u64 actual_end; > + loff_t i_size = i_size_read(inode); > int ret = 0; > struct page **pages = NULL; > unsigned long nr_pages; > @@ -488,7 +489,13 @@ static noinline int compress_file_range(struct async_chunk *async_chunk) > inode_should_defrag(BTRFS_I(inode), start, end, end - start + 1, > SZ_16K); > > - actual_end = min_t(u64, i_size_read(inode), end + 1); > + /* > + * We need to save i_size before now because it could change in between > + * us evaluating the size and assigning it. This is because we lock and > + * unlock the page in truncate and fallocate, and then modify the i_size > + * later on. > + */ > + actual_end = min_t(u64, i_size, end + 1); Ping. This is not a future proof fix, please update the changelog and code according to the reply I sent.