diff mbox series

[3/7] generic/724,xfs/791: adjust test preconditions for post-EOF stripe zeroing

Message ID 168305810303.331137.12116775179614442990.stgit@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series fstests: random fixes for v2023.05.01 | expand

Commit Message

Darrick J. Wong May 2, 2023, 8:08 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

I recently introduced a new fstests config with explicitly specified
stripe geometry of 128k stripe units and a stripe width of 4.  This
broke both of these tests because I hadn't counted on a few things:

1) The write to $SCRATCH_MNT/b at 768k would a 128k delalloc extent
2) This delalloc extent would extend beyond EOF
3) Increasing the file size from 832k to 1m would cause iomap to zero
   the pagecache for the parts of the delalloc extent beyond EOF
4) The newly dirtied posteof delalloc areas would get written to disk
   with a real space allocation

Under these circumstances, FIEXCHRANGE with SKIP_FILE1_HOLES sees a
written extent containing zeroes in file B between 832k and 1m.  File
A has a written extent containing 'X' in the same range, so it exchanges
the two.  When RAID geometry is disabled, the area between 832k and 1m
is usually a hole, so FIEXCHRANGE does nothing.  This causes the md5sum
of the two files to be different, and the test fails.

Fix the test by truncating B to 1m before writing anything to it.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/724 |    2 +-
 tests/xfs/791     |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/tests/generic/724 b/tests/generic/724
index 90cff8cf31..8d7dc4e12a 100755
--- a/tests/generic/724
+++ b/tests/generic/724
@@ -33,9 +33,9 @@  _require_congruent_file_oplen $SCRATCH_MNT 65536
 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
 
 # Create the donor file
+$XFS_IO_PROG -f -c 'truncate 1m' $SCRATCH_MNT/b
 _pwrite_byte 0x59 64k 64k $SCRATCH_MNT/b >> $seqres.full
 _pwrite_byte 0x57 768k 64k $SCRATCH_MNT/b >> $seqres.full
-$XFS_IO_PROG -c 'truncate 1m' $SCRATCH_MNT/b
 
 md5sum $SCRATCH_MNT/a | _filter_scratch
 md5sum $SCRATCH_MNT/b | _filter_scratch
diff --git a/tests/xfs/791 b/tests/xfs/791
index c89bc3531e..d82314ee08 100755
--- a/tests/xfs/791
+++ b/tests/xfs/791
@@ -37,9 +37,9 @@  _require_congruent_file_oplen $SCRATCH_MNT 65536
 _pwrite_byte 0x58 0 1m $SCRATCH_MNT/a >> $seqres.full
 
 # Create the donor file
+$XFS_IO_PROG -f -c 'truncate 1m' $SCRATCH_MNT/b
 _pwrite_byte 0x59 64k 64k $SCRATCH_MNT/b >> $seqres.full
 _pwrite_byte 0x57 768k 64k $SCRATCH_MNT/b >> $seqres.full
-$XFS_IO_PROG -c 'truncate 1m' $SCRATCH_MNT/b
 sync
 
 md5sum $SCRATCH_MNT/a | _filter_scratch