On Thu 18-05-17 17:47:53, Eryu Guan wrote: > On Thu, May 18, 2017 at 11:03:46AM +0200, Jan Kara wrote: > > On Wed 17-05-17 16:57:46, Jan Kara wrote: > > > On Wed 17-05-17 20:31:15, Eryu Guan wrote: > > > > Hi Jan, > > > > > > > > On Wed, May 17, 2017 at 02:10:43PM +0200, Jan Kara wrote: > > > > > Hello, > > > > > > > > > > this is the second revision of the patches to fix bugs in XFS's SEEK_HOLE > > > > > implementation and cleanup the code a bit. > > > > > > > > > > Changes since v1: > > > > > * Fixed some more buggy cases > > > > > * Simplified code a bit as suggested by Darrick > > > > > * Fixed range check as spotted by Brian > > > > > > > > I applied this patchset on top of 4.12-rc1 kernel to test your v4 test > > > > case, your new test passed all my tests, but I found generic/285 > > > > regressed with sub-page block size XFS, 285.full showed that failure was > > > > from subtest 7 > > > > > > > > 07. Test file with unwritten extents, only have dirty pages > > > > 07.01 SEEK_HOLE expected 0 or 11264, got 0. succ > > > > 07.02 SEEK_HOLE expected 1 or 11264, got 1. succ > > > > 07.03 SEEK_DATA expected 10240 or 10240, got -1. FAIL > > > > 07.04 SEEK_DATA expected 10240 or 10240, got -1. FAIL > > > > > > > > And manual test showed subtest 8 failed too > > > > > > > > # ./src/seek_sanity_test -s 8 -e 8 /mnt/xfs/testfile > > > > File system magic#: 0x58465342 > > > > Allocation size: 4096 > > > > > > > > 08. Test file with unwritten extents, only have unwritten pages > > > > 08.01 SEEK_HOLE expected 0 or 5632, got 0. succ > > > > 08.02 SEEK_HOLE expected 1 or 5632, got 1. succ > > > > 08.03 SEEK_DATA expected 5120 or 5120, got -1. FAIL > > > > 08.04 SEEK_DATA expected 5120 or 5120, got -1. FAIL > > > > > > > > Other subtests all passed with sub-page block size XFS. > > > > > > Strange. It doesn't fail for me this way even with 1k blocksize. I'll > > > investigate more tomorrow. > > > > So I've been trying quite hard to reproduce the failure but I failed. Since > > you are apparently getting some error out of lseek can you find out which > > error it is (likely ENXIO but I'd like to confirm) and where it gets > > generated? I don't see how it could possibly happen that SEEK_DATA would > > miss that single page generated by this test and how any of my patches > > would influence this particular situation. Thanks! <snip> > Seems that's because the do {} while() loop in xfs_find_get_desired_pgoff() was > broken out earlier due to patch 2. > > /* Searching done if the page index is out of range. */ > if (page->index >= end) { > goto out; > } > > In my case, it returned earlier because page->index == end == 2. Ah! That's it. I'm not sure why you get so short unwritten extent but it's certainly possible. I can now reproduce the issue with: xfs_io -f -c "falloc 0 10k" -c "pwrite 9k 512" -c "seek -d 0" /mnt/file wrote 512/512 bytes at offset 9216 512.000000 bytes, 1 ops; 0.0000 sec (6.975 MiB/sec and 14285.7143 ops/sec) Whence Result DATA EOF on 1k blocksize filesystem. And the problem is indeed that in this case I have screwed up the condition due to rounding. I'll fix the second patch in both series for ext4 & xfs. Thanks for debugging this! Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html