On Fri, Dec 08, 2023 at 02:39:36PM -0800, Luis Chamberlain wrote: > Commit aa5b9178c0190 ("mm: invalidation check mapping before folio_contains") > added on v6.6-rc1 moved the VM_BUG_ON_FOLIO() on invalidate_inode_pages2_range() > after the truncation check. > > We managed to hit this VM_BUG_ON_FOLIO() a few times on v6.6-rc5 with a slew > of fstsets tests on kdevops [0] on the following XFS config as defined by > kdevops XFS's configurations [1] for XFS with the following failure rates > annotated: > > * xfs_reflink_4k: F:1/278 - one out of 278 times > - generic/451: (trace pasted below after running test over 17 hours) > * xfs_nocrc_4k: F:1/1604 - one ou tof 1604 times > - generic/451: https://gist.github.com/mcgrof/2c40a14979ceeb7321d2234a525c32a6 > > To be clear F:1/1604 means you can run the test in a loop and on test number > about 1604 you may run into the bug. It would seem Zorro had hit also > with a 64k directory size (mkfs.xfs -n size=65536) on v5.19-rc2, so prior > to Hugh's move of the VM_BUG_ON_FOLIO() while testing generic/132 [0]. > > My hope is that this could help those interested in reproducing, to > spawn up kdevops and just run the test in a loop in the same way. > Likewise, if you have a fix to test we can test it as well, but it will > take a while as we want to run the test in a loop over and over many > times. I'm pretty sure this is the same problem recently diagnosed by Charan. It's terribly rare, so it'll take a while to find out. Try the attached patch?