* [PATCH 1/3] xfs: skip fragmentation tests when alwayscow mode is enabled
2023-01-18 0:41 [PATCHSET 0/3] fstests: fix tests when XFS always_cow mode enabled Darrick J. Wong
@ 2023-01-18 0:43 ` Darrick J. Wong
2023-01-18 5:43 ` Christoph Hellwig
2023-01-18 0:43 ` [PATCH 2/3] xfs/{080,329,434,436}: add missing check for fallocate support Darrick J. Wong
2023-01-18 0:43 ` [PATCH 3/3] various: test is not appropriate for always_cow mode Darrick J. Wong
2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2023-01-18 0:43 UTC (permalink / raw)
To: djwong, zlang; +Cc: linux-xfs, fstests, guan
From: Darrick J. Wong <djwong@kernel.org>
If the always_cow debugging flag is enabled, all file writes turn into
copy writes. This dramatically ramps up fragmentation in the filesystem
(intentionally!) so there's no point in complaining about fragmentation.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
common/xfs | 9 +++++++++
tests/xfs/182 | 1 +
tests/xfs/192 | 1 +
tests/xfs/198 | 1 +
tests/xfs/204 | 1 +
tests/xfs/211 | 1 +
6 files changed, 14 insertions(+)
diff --git a/common/xfs b/common/xfs
index 7eee76c0ee..a00d90a4b5 100644
--- a/common/xfs
+++ b/common/xfs
@@ -1108,6 +1108,15 @@ _require_no_xfs_bug_on_assert()
fi
}
+# Require that XFS is not configured in always_cow mode.
+_require_no_xfs_always_cow()
+{
+ if [ -f /sys/fs/xfs/debug/always_cow ]; then
+ grep -q "1" /sys/fs/xfs/debug/always_cow && \
+ _notrun "test requires XFS always_cow to be off, turn it off to run the test"
+ fi
+}
+
# Get a metadata field
# The first arg is the field name
# The rest of the arguments are xfs_db commands to find the metadata.
diff --git a/tests/xfs/182 b/tests/xfs/182
index 696b933e60..511aca6f2d 100755
--- a/tests/xfs/182
+++ b/tests/xfs/182
@@ -24,6 +24,7 @@ _require_cp_reflink
_require_xfs_io_command "fiemap"
_require_xfs_io_command "cowextsize"
_require_odirect
+_require_no_xfs_always_cow # writes have to converge to overwrites
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/192 b/tests/xfs/192
index ced18fa3c1..eb577f15fc 100755
--- a/tests/xfs/192
+++ b/tests/xfs/192
@@ -26,6 +26,7 @@ _require_xfs_io_command "fiemap"
_require_xfs_io_command "cowextsize"
_require_xfs_io_command "funshare"
_require_odirect
+_require_no_xfs_always_cow # writes have to converge to overwrites
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/198 b/tests/xfs/198
index c61fbab70d..e5b98609de 100755
--- a/tests/xfs/198
+++ b/tests/xfs/198
@@ -23,6 +23,7 @@ _require_cp_reflink
_require_xfs_io_command "fiemap"
_require_xfs_io_command "cowextsize"
_require_odirect
+_require_no_xfs_always_cow # writes have to converge to overwrites
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/204 b/tests/xfs/204
index ca21dfe722..7d6b79a86d 100755
--- a/tests/xfs/204
+++ b/tests/xfs/204
@@ -28,6 +28,7 @@ _require_xfs_io_command "fiemap"
_require_xfs_io_command "cowextsize"
_require_xfs_io_command "funshare"
_require_odirect
+_require_no_xfs_always_cow # writes have to converge to overwrites
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
diff --git a/tests/xfs/211 b/tests/xfs/211
index 96c0b85b14..3ce6496afc 100755
--- a/tests/xfs/211
+++ b/tests/xfs/211
@@ -24,6 +24,7 @@ _require_cp_reflink
_require_xfs_io_command "fiemap"
_require_xfs_io_command "cowextsize"
_require_odirect
+_require_no_xfs_always_cow # writes have to converge to overwrites
echo "Format and mount"
_scratch_mkfs > $seqres.full 2>&1
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/3] xfs/{080,329,434,436}: add missing check for fallocate support
2023-01-18 0:41 [PATCHSET 0/3] fstests: fix tests when XFS always_cow mode enabled Darrick J. Wong
2023-01-18 0:43 ` [PATCH 1/3] xfs: skip fragmentation tests when alwayscow mode is enabled Darrick J. Wong
@ 2023-01-18 0:43 ` Darrick J. Wong
2023-01-18 5:43 ` Christoph Hellwig
2023-01-18 0:43 ` [PATCH 3/3] various: test is not appropriate for always_cow mode Darrick J. Wong
2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2023-01-18 0:43 UTC (permalink / raw)
To: djwong, zlang; +Cc: linux-xfs, fstests, guan
From: Darrick J. Wong <djwong@kernel.org>
Don't run this test if the filesystem doesn't support fallocate. This
is only ever the case if always_cow is enabled.
The same logic applies to xfs/329, though it's more subtle because the
test itself does not explicitly invoke fallocate; rather, it is xfs_fsr
that requires fallocate.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/xfs/080 | 1 +
tests/xfs/329 | 1 +
tests/xfs/434 | 1 +
tests/xfs/436 | 1 +
4 files changed, 4 insertions(+)
diff --git a/tests/xfs/080 b/tests/xfs/080
index 20b20a08eb..abcfa004b5 100755
--- a/tests/xfs/080
+++ b/tests/xfs/080
@@ -21,6 +21,7 @@ _cleanup()
_supported_fs xfs
_require_test
+_require_xfs_io_command falloc # iogen requires falloc
quiet=-q
clean=-c
diff --git a/tests/xfs/329 b/tests/xfs/329
index 4cad686c17..15dc3c242f 100755
--- a/tests/xfs/329
+++ b/tests/xfs/329
@@ -22,6 +22,7 @@ _require_cp_reflink
_require_command "$XFS_FSR_PROG" "xfs_fsr"
_require_xfs_io_error_injection "bmap_finish_one"
_require_xfs_scratch_rmapbt
+_require_xfs_io_command falloc # fsr requires support for preallocation
rm -f "$seqres.full"
diff --git a/tests/xfs/434 b/tests/xfs/434
index 576f1b0e1e..de52531053 100755
--- a/tests/xfs/434
+++ b/tests/xfs/434
@@ -35,6 +35,7 @@ _require_quota
_require_scratch_reflink
_require_cp_reflink
_require_command "$XFS_FSR_PROG" "xfs_fsr"
+_require_xfs_io_command falloc # fsr requires support for preallocation
_require_xfs_io_error_injection "bmap_finish_one"
_require_xfs_scratch_rmapbt
diff --git a/tests/xfs/436 b/tests/xfs/436
index 9e6ec9372d..b95da8abf4 100755
--- a/tests/xfs/436
+++ b/tests/xfs/436
@@ -30,6 +30,7 @@ _supported_fs xfs
_require_loadable_fs_module "xfs"
_require_scratch_reflink
_require_cp_reflink
+_require_xfs_io_command falloc # fsr requires support for preallocation
_require_command "$XFS_FSR_PROG" "xfs_fsr"
_require_xfs_io_error_injection "bmap_finish_one"
_require_xfs_scratch_rmapbt
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 2/3] xfs/{080,329,434,436}: add missing check for fallocate support
2023-01-18 0:43 ` [PATCH 2/3] xfs/{080,329,434,436}: add missing check for fallocate support Darrick J. Wong
@ 2023-01-18 5:43 ` Christoph Hellwig
0 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2023-01-18 5:43 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: zlang, linux-xfs, fstests, guan
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 3/3] various: test is not appropriate for always_cow mode
2023-01-18 0:41 [PATCHSET 0/3] fstests: fix tests when XFS always_cow mode enabled Darrick J. Wong
2023-01-18 0:43 ` [PATCH 1/3] xfs: skip fragmentation tests when alwayscow mode is enabled Darrick J. Wong
2023-01-18 0:43 ` [PATCH 2/3] xfs/{080,329,434,436}: add missing check for fallocate support Darrick J. Wong
@ 2023-01-18 0:43 ` Darrick J. Wong
2023-01-18 5:43 ` Christoph Hellwig
2 siblings, 1 reply; 7+ messages in thread
From: Darrick J. Wong @ 2023-01-18 0:43 UTC (permalink / raw)
To: djwong, zlang; +Cc: linux-xfs, fstests, guan
From: Darrick J. Wong <djwong@kernel.org>
When always_cow mode is enabled, thes tests cannot set up the
preconditions for the functionality that they wants to test and should
be skipped.
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
tests/generic/392 | 10 ++++++++++
tests/xfs/326 | 12 ++++++++++++
tests/xfs/558 | 6 ++++++
3 files changed, 28 insertions(+)
diff --git a/tests/generic/392 b/tests/generic/392
index ac4014ab0c..c4bb3f4b92 100755
--- a/tests/generic/392
+++ b/tests/generic/392
@@ -28,6 +28,16 @@ _scratch_mkfs >/dev/null 2>&1
_require_metadata_journaling $SCRATCH_DEV
_scratch_mount
+# This test requires that i_blocks remains unchanged from the start of the
+# check_inode_metadata call until after recovery is complete. fpunch calls
+# turn into pagecache writes if the arguments are not aligned to the fs
+# blocksize. If the range being punched is already mapped to a written extent
+# and alwayscow is enabled, i_blocks will increase by the size of the COW
+# staging extent. This causes stat to report different numbers for %b, which
+# results in a test failure. Hence do not run this test if XFS is in alwayscow
+# mode.
+test "$FSTYP" = "xfs" && _require_no_xfs_always_cow
+
testfile=$SCRATCH_MNT/testfile
# check inode metadata after shutdown
diff --git a/tests/xfs/326 b/tests/xfs/326
index 8ab60684bf..ac620fc433 100755
--- a/tests/xfs/326
+++ b/tests/xfs/326
@@ -43,6 +43,18 @@ _scratch_mount >> $seqres.full
_require_congruent_file_oplen $SCRATCH_MNT $blksz
$XFS_IO_PROG -c "cowextsize $sz" $SCRATCH_MNT
+# This test uses a very large cowextszhint to manipulate the COW fork to
+# contain a large unwritten extent before injecting the error. The goal is
+# that the write() will succeed, writeback will flush the dirty data to disk,
+# and writeback completion will shut down the filesystem when it tries to
+# remove the staging extent record from the refcount btree. In other words,
+# this test ensures that XFS always finishes a COW completion it has started.
+#
+# This test isn't compatible with always_cow mode because the hole in the COW
+# fork left by the first write means that writeback tries to allocate a COW
+# staging extent for an unshared extent and trips over the injected error.
+_require_no_xfs_always_cow
+
echo "Create files"
_pwrite_byte 0x66 0 $sz $SCRATCH_MNT/file1 >> $seqres.full
_cp_reflink $SCRATCH_MNT/file1 $SCRATCH_MNT/file2
diff --git a/tests/xfs/558 b/tests/xfs/558
index 819faf22bc..9e9b3be867 100755
--- a/tests/xfs/558
+++ b/tests/xfs/558
@@ -114,6 +114,12 @@ _require_xfs_io_error_injection "wb_delay_ms"
_require_scratch_reflink
_require_cp_reflink
+# This test races writeback of a pure overwrite of a data fork extent against
+# the creation of a speculative COW preallocation. In alwayscow mode, there
+# are no pure overwrites, which means that a precondition of the test is not
+# satisfied, and this test should be skipped.
+_require_no_xfs_always_cow
+
_scratch_mkfs >> $seqres.full
_scratch_mount >> $seqres.full
^ permalink raw reply related [flat|nested] 7+ messages in thread