On Fri, Jul 01, 2022 at 10:25:58AM +0900, Dominique MARTINET wrote: > Filipe Manana wrote on Thu, Jun 30, 2022 at 04:10:38PM +0100: > > This may prevent the short reads (not tested yet): > > > > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c > > index 7a54f964ff37..42fb56ed0021 100644 > > --- a/fs/btrfs/inode.c > > +++ b/fs/btrfs/inode.c > > @@ -7684,7 +7684,7 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start, > > if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) || > > em->block_start == EXTENT_MAP_INLINE) { > > free_extent_map(em); > > - ret = -ENOTBLK; > > + ret = (flags & IOMAP_NOWAIT) ? -EAGAIN : -ENOTBLK; > > goto unlock_err; > > } > > > > Can you give it a try? > > This appears to do the trick! > I've also removed the first patch and still cannot see any short reads, > so this would be enough on its own for my case. Great. After my last reply, I retried your reproducer (and qemu image file) on a fs mounted with -o compress-force=zstd and was able to trigger the short reads in less than a minute. Witht that patch I can no longer trigger the short reads too (after running the reproducer for about 2 hours). I'll give it some more testing here along with other minor fixes I have for other scenarios. I'll submit a patchset, with this fix included, on monday. I'll add your Tested-by tag for this specific patch. Thanks for all the testing and the reproducer! > > -- > Dominique