xfs/42[01]: don't disturb unwritten status with md5sum

The way we decided if an unwritten extent is considered a hole or
data is by checking if the page and/or blocks are marked uptodate,
that is contain valid data in the page cache.

xfs/420 and xfs/421 try to exercise SEEK_HOLE / SEEK_DATA in the
presence of cowextsize preallocations over holes in the data fork.
The current XFS code never actually uses those for buffer writes,
but a pending patch changes that.  For SEEK_HOLE / SEEK_DATA to work
properly in that case we also need to look at the COW fork in their
implementations and thus have to rely on the unwritten extent page
cache probing.  But the tests for it ensure we do have valid data in
the pagecache by calling md5sum on the test files, and thus reading
their contents (including the zero-filled holes) in, and thus making
them all valid data.

Fix that by dropping the page cache content after the md5sum calls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
This commit is contained in:
Christoph Hellwig
2019-02-18 10:19:51 +01:00
committed by Eryu Guan
parent ead024c292
commit 6be9a78618
2 changed files with 12 additions and 0 deletions
+6
View File
@@ -83,6 +83,8 @@ echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
md5sum $testdir/file3 | _filter_scratch
# drop caches to make sure the page cache for the unwritten extents is clean
echo 1 > /proc/sys/vm/drop_caches
echo "CoW the shared part then write into the empty part" | tee -a $seqres.full
$XFS_IO_PROG -c "cowextsize" $testdir/file1 >> $seqres.full
@@ -106,6 +108,8 @@ echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
md5sum $testdir/file3 | _filter_scratch
# drop caches to make sure the page cache for the unwritten extents is clean
echo 1 > /proc/sys/vm/drop_caches
echo "sync filesystem" | tee -a $seqres.full
sync
@@ -123,6 +127,8 @@ echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
md5sum $testdir/file3 | _filter_scratch
# drop caches to make sure the page cache for the unwritten extents is clean
echo 1 > /proc/sys/vm/drop_caches
echo "Remount" | tee -a $seqres.full
_scratch_cycle_mount
+6
View File
@@ -83,6 +83,8 @@ echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
md5sum $testdir/file3 | _filter_scratch
# drop caches to make sure the page cache for the unwritten extents is clean
echo 1 > /proc/sys/vm/drop_caches
echo "CoW the shared part then write into the empty part" | tee -a $seqres.full
$XFS_IO_PROG -c "cowextsize" $testdir/file1 >> $seqres.full
@@ -106,6 +108,8 @@ echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
md5sum $testdir/file3 | _filter_scratch
# drop caches to make sure the page cache for the unwritten extents is clean
echo 1 > /proc/sys/vm/drop_caches
echo "sync filesystem" | tee -a $seqres.full
sync
@@ -123,6 +127,8 @@ echo "Compare files"
md5sum $testdir/file1 | _filter_scratch
md5sum $testdir/file2 | _filter_scratch
md5sum $testdir/file3 | _filter_scratch
# drop caches to make sure the page cache for the unwritten extents is clean
echo 1 > /proc/sys/vm/drop_caches
echo "Remount" | tee -a $seqres.full
_scratch_cycle_mount