]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/724,xfs/791: adjust test preconditions for post-EOF stripe zeroing
authorDarrick J. Wong <djwong@kernel.org>
Tue, 2 May 2023 20:08:23 +0000 (13:08 -0700)
committerZorro Lang <zlang@kernel.org>
Sun, 14 May 2023 13:50:55 +0000 (21:50 +0800)
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>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/generic/724
tests/xfs/791

index 90cff8cf316a270b8b37d9877c4da58ac0b770fe..8d7dc4e12ad0eb2b3498efc5224aad288618dabb 100755 (executable)
@@ -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
index c89bc3531e7e10f9d0eb5e1eef7b669ae985cfb5..d82314ee082051fbb85d0d3aba341a731605f79e 100755 (executable)
@@ -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