On Sep 23, 2021 / 10:37, Ming Lei wrote: > When running ->fallocate(), blkdev_fallocate() should hold > mapping->invalidate_lock to prevent page cache from being accessed, > otherwise stale data may be read in page cache. > > Without this patch, blktests block/009 fails sometimes. With this patch, > block/009 can pass always. > > Also as Jan pointed out, no pages can be created in the discarded area > while you are holding the invalidate_lock, so remove the 2nd > truncate_bdev_range(). Hello Ming, Jan, thanks for the fix. Unfortunately, I still observe block/009 failure on the kernel version 5.15.0, which includes this fix patch. I found that BLKDISCARD ioctl has the same problem. I modified blk_ioctl_discard() in same manner, and the block/009 failure goes away. I also found that BLKZEROOUT has the same issue. I will post two patches for these ioctl. Your reviews will be appreciated. -- Best Regards, Shin'ichiro Kawasaki