* [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow
@ 2024-02-01 18:03 fdmanana
2024-02-01 18:03 ` [PATCH 1/4] btrfs: require no nodatacow for tests that exercise compression fdmanana
` (4 more replies)
0 siblings, 5 replies; 7+ messages in thread
From: fdmanana @ 2024-02-01 18:03 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Filipe Manana
From: Filipe Manana <fdmanana@suse.com>
Several test btrfs test cases fail when using "-o nodatacow" in MOUNT_OPTIONS.
So fix that by either adapting the tests to pass or skip them if there's no
way for them to succeed in nodatacow mode.
Filipe Manana (4):
btrfs: require no nodatacow for tests that exercise compression
btrfs/173: make the test work when mounting with nodatacow
btrfs/299: skip test if we were mounted with nodatacow
btrfs: require no nodatacow for tests that exercise read repair
tests/btrfs/024 | 1 +
tests/btrfs/048 | 1 +
tests/btrfs/059 | 1 +
tests/btrfs/138 | 1 +
tests/btrfs/140 | 3 ++-
tests/btrfs/141 | 2 ++
tests/btrfs/157 | 2 ++
tests/btrfs/158 | 2 ++
tests/btrfs/173 | 5 +++++
tests/btrfs/215 | 2 ++
tests/btrfs/234 | 1 +
tests/btrfs/265 | 2 ++
tests/btrfs/266 | 2 ++
tests/btrfs/267 | 2 ++
tests/btrfs/268 | 2 ++
tests/btrfs/269 | 2 ++
tests/btrfs/281 | 1 +
tests/btrfs/289 | 2 ++
tests/btrfs/299 | 3 +++
19 files changed, 36 insertions(+), 1 deletion(-)
--
2.40.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] btrfs: require no nodatacow for tests that exercise compression
2024-02-01 18:03 [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow fdmanana
@ 2024-02-01 18:03 ` fdmanana
2024-02-01 18:03 ` [PATCH 2/4] btrfs/173: make the test work when mounting with nodatacow fdmanana
` (3 subsequent siblings)
4 siblings, 0 replies; 7+ messages in thread
From: fdmanana @ 2024-02-01 18:03 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Filipe Manana
From: Filipe Manana <fdmanana@suse.com>
Several test cases fail when running with MOUNT_OPTIONS="-o nodatacow"
because they attempt to use compression and compression can not be
enabled on nodatacow files (it fails with -EINVAL). So make sure those
tests are not run if nodatacow is specified in MOUNT_OPTIONS.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
tests/btrfs/024 | 1 +
tests/btrfs/048 | 1 +
tests/btrfs/059 | 1 +
tests/btrfs/138 | 1 +
tests/btrfs/234 | 1 +
tests/btrfs/281 | 1 +
6 files changed, 6 insertions(+)
diff --git a/tests/btrfs/024 b/tests/btrfs/024
index 95c734ec..a8ca0e1d 100755
--- a/tests/btrfs/024
+++ b/tests/btrfs/024
@@ -17,6 +17,7 @@ _begin_fstest auto quick compress
# real QA test starts here
_supported_fs btrfs
_require_scratch
+_require_btrfs_no_nodatacow
__workout()
{
diff --git a/tests/btrfs/048 b/tests/btrfs/048
index 8a88b8cc..aa2030b1 100755
--- a/tests/btrfs/048
+++ b/tests/btrfs/048
@@ -30,6 +30,7 @@ _require_test
_require_scratch
_require_btrfs_command "property"
_require_btrfs_command inspect-internal dump-super
+_require_btrfs_no_nodatacow
send_files_dir=$TEST_DIR/btrfs-test-$seq
diff --git a/tests/btrfs/059 b/tests/btrfs/059
index 76a1e76e..8b458b34 100755
--- a/tests/btrfs/059
+++ b/tests/btrfs/059
@@ -28,6 +28,7 @@ _supported_fs btrfs
_require_test
_require_scratch
_require_btrfs_command "property"
+_require_btrfs_no_nodatacow
_scratch_mkfs >> $seqres.full 2>&1
_scratch_mount
diff --git a/tests/btrfs/138 b/tests/btrfs/138
index f99e58e7..427fdede 100755
--- a/tests/btrfs/138
+++ b/tests/btrfs/138
@@ -18,6 +18,7 @@ _begin_fstest auto compress
_supported_fs btrfs
_require_scratch
_require_btrfs_command property
+_require_btrfs_no_nodatacow
algos=($(_btrfs_compression_algos))
diff --git a/tests/btrfs/234 b/tests/btrfs/234
index c045ea6c..542515e8 100755
--- a/tests/btrfs/234
+++ b/tests/btrfs/234
@@ -18,6 +18,7 @@ _begin_fstest auto quick compress rw
_supported_fs btrfs
_require_scratch
_require_odirect
+_require_btrfs_no_nodatacow
_require_chattr c
_scratch_mkfs >>$seqres.full 2>&1
diff --git a/tests/btrfs/281 b/tests/btrfs/281
index 63fb89ea..64075225 100755
--- a/tests/btrfs/281
+++ b/tests/btrfs/281
@@ -25,6 +25,7 @@ _require_scratch_reflink
_require_btrfs_send_v2
_require_xfs_io_command "fiemap"
_require_fssum
+_require_btrfs_no_nodatacow
_fixed_by_kernel_commit a11452a3709e \
"btrfs: send: avoid unaligned encoded writes when attempting to clone range"
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] btrfs/173: make the test work when mounting with nodatacow
2024-02-01 18:03 [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow fdmanana
2024-02-01 18:03 ` [PATCH 1/4] btrfs: require no nodatacow for tests that exercise compression fdmanana
@ 2024-02-01 18:03 ` fdmanana
2024-02-05 12:26 ` David Disseldorp
2024-02-01 18:03 ` [PATCH 3/4] btrfs/299: skip test if we were mounted " fdmanana
` (2 subsequent siblings)
4 siblings, 1 reply; 7+ messages in thread
From: fdmanana @ 2024-02-01 18:03 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Filipe Manana
From: Filipe Manana <fdmanana@suse.com>
Currently btrfs/173 fails when passing "-o nodatacow" to MOUNT_OPTIONS
because it assumes that when creating a file it does not have the
nodatacow flag set, which is obviously not true if the fs is mounted with
"-o nodatacow". To allow the test to run successfully with nodatacow,
just make sure it clears the nodatacow flag from the file if the fs was
mounted with "-o nodatacow".
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
tests/btrfs/173 | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tests/btrfs/173 b/tests/btrfs/173
index 6e78a826..42af2d26 100755
--- a/tests/btrfs/173
+++ b/tests/btrfs/173
@@ -23,6 +23,11 @@ echo "COW file"
# unset it after the swap file has been created.
rm -f "$SCRATCH_MNT/swap"
touch "$SCRATCH_MNT/swap"
+# Make sure we have a COW file if we were mounted with "-o nodatacow".
+if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "nodatacow"; then
+ _require_chattr C
+ $CHATTR_PROG -C "$SCRATCH_MNT/swap"
+fi
chmod 0600 "$SCRATCH_MNT/swap"
_pwrite_byte 0x61 0 $(($(_get_page_size) * 10)) "$SCRATCH_MNT/swap" >> $seqres.full
$MKSWAP_PROG "$SCRATCH_MNT/swap" >> $seqres.full
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] btrfs/299: skip test if we were mounted with nodatacow
2024-02-01 18:03 [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow fdmanana
2024-02-01 18:03 ` [PATCH 1/4] btrfs: require no nodatacow for tests that exercise compression fdmanana
2024-02-01 18:03 ` [PATCH 2/4] btrfs/173: make the test work when mounting with nodatacow fdmanana
@ 2024-02-01 18:03 ` fdmanana
2024-02-01 18:03 ` [PATCH 4/4] btrfs: require no nodatacow for tests that exercise read repair fdmanana
2024-02-05 12:29 ` [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow David Disseldorp
4 siblings, 0 replies; 7+ messages in thread
From: fdmanana @ 2024-02-01 18:03 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Filipe Manana
From: Filipe Manana <fdmanana@suse.com>
The test requires the ability to create an inline extent in a file with
a prealloced extent, created with fallocate's FALLOC_FL_KEEP_SIZE mode,
which can only happen when COW is enabled. If the test is run with
MOUNT_OPTIONS="-o nodatacow", then COW never happens as all writes end
up using the preallocated extent. This results in the logical-resolve
command to return one file path when it should return none, since the
base logical address of the prealloc extent is still in use unless COW
happens.
So make the test not run if nodatacow is specified in MOUNT_OPTIONS.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
tests/btrfs/299 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tests/btrfs/299 b/tests/btrfs/299
index c4b1c7c5..d38bf2ac 100755
--- a/tests/btrfs/299
+++ b/tests/btrfs/299
@@ -23,6 +23,9 @@ _supported_fs btrfs
_require_scratch
_require_xfs_io_command "falloc" "-k"
_require_btrfs_command inspect-internal logical-resolve
+# Can't run with nodatacow because we need to be able to create an inline extent
+# in a range with a prealloc extent, which can only happen with COW enabled.
+_require_btrfs_no_nodatacow
_fixed_by_kernel_commit 560840afc3e6 \
"btrfs: fix resolving backrefs for inline extent followed by prealloc"
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] btrfs: require no nodatacow for tests that exercise read repair
2024-02-01 18:03 [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow fdmanana
` (2 preceding siblings ...)
2024-02-01 18:03 ` [PATCH 3/4] btrfs/299: skip test if we were mounted " fdmanana
@ 2024-02-01 18:03 ` fdmanana
2024-02-05 12:29 ` [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow David Disseldorp
4 siblings, 0 replies; 7+ messages in thread
From: fdmanana @ 2024-02-01 18:03 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, Filipe Manana
From: Filipe Manana <fdmanana@suse.com>
Several test cases that exercise the ability to detect corrupted data and
repair it, fail when "-o nodatacow" is passed to MOUNT_OPTIONS, because
that ability requires the existence of data checksums, and those are
disabled in nodatacow mode. So skip the tests when "-o nodatacow" is
present.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
tests/btrfs/140 | 3 ++-
tests/btrfs/141 | 2 ++
tests/btrfs/157 | 2 ++
tests/btrfs/158 | 2 ++
tests/btrfs/215 | 2 ++
tests/btrfs/265 | 2 ++
tests/btrfs/266 | 2 ++
tests/btrfs/267 | 2 ++
tests/btrfs/268 | 2 ++
tests/btrfs/269 | 2 ++
tests/btrfs/289 | 2 ++
11 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/tests/btrfs/140 b/tests/btrfs/140
index 247a7356..5ce65886 100755
--- a/tests/btrfs/140
+++ b/tests/btrfs/140
@@ -22,7 +22,8 @@ _begin_fstest auto quick read_repair fiemap
# Modify as appropriate.
_supported_fs btrfs
_require_scratch_dev_pool 2
-
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_btrfs_command inspect-internal dump-tree
_require_odirect
# Overwriting data is forbidden on a zoned block device
diff --git a/tests/btrfs/141 b/tests/btrfs/141
index 90a90d00..e1adb91e 100755
--- a/tests/btrfs/141
+++ b/tests/btrfs/141
@@ -22,6 +22,8 @@ _begin_fstest auto quick read_repair
# Modify as appropriate.
_supported_fs btrfs
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_scratch_dev_pool 2
_require_btrfs_command inspect-internal dump-tree
diff --git a/tests/btrfs/157 b/tests/btrfs/157
index 022db511..648db0d0 100755
--- a/tests/btrfs/157
+++ b/tests/btrfs/157
@@ -30,6 +30,8 @@ _begin_fstest auto quick raid read_repair
# Modify as appropriate.
_supported_fs btrfs
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_scratch_dev_pool 4
_require_btrfs_command inspect-internal dump-tree
_require_btrfs_fs_feature raid56
diff --git a/tests/btrfs/158 b/tests/btrfs/158
index aa85835a..28599d09 100755
--- a/tests/btrfs/158
+++ b/tests/btrfs/158
@@ -22,6 +22,8 @@ _begin_fstest auto quick raid scrub
# Modify as appropriate.
_supported_fs btrfs
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_scratch_dev_pool 4
_require_btrfs_command inspect-internal dump-tree
_require_btrfs_fs_feature raid56
diff --git a/tests/btrfs/215 b/tests/btrfs/215
index 00646898..6fa226fe 100755
--- a/tests/btrfs/215
+++ b/tests/btrfs/215
@@ -25,6 +25,8 @@ get_physical()
# Modify as appropriate.
_supported_fs btrfs
_require_scratch
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
# Overwriting data is forbidden on a zoned block device
_require_non_zoned_device $SCRATCH_DEV
diff --git a/tests/btrfs/265 b/tests/btrfs/265
index b75d9c84..127da7ad 100755
--- a/tests/btrfs/265
+++ b/tests/btrfs/265
@@ -19,6 +19,8 @@ _begin_fstest auto quick read_repair
_supported_fs btrfs
_require_scratch_dev_pool 3
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_odirect
# Overwriting data is forbidden on a zoned block device
_require_non_zoned_device "${SCRATCH_DEV}"
diff --git a/tests/btrfs/266 b/tests/btrfs/266
index 42aff7c0..acfb1d59 100755
--- a/tests/btrfs/266
+++ b/tests/btrfs/266
@@ -18,6 +18,8 @@ _begin_fstest auto quick read_repair
# real QA test starts here
_supported_fs btrfs
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_scratch_dev_pool 3
_require_odirect
diff --git a/tests/btrfs/267 b/tests/btrfs/267
index 75a6fdcc..51b28d9b 100755
--- a/tests/btrfs/267
+++ b/tests/btrfs/267
@@ -20,6 +20,8 @@ _begin_fstest auto quick read_repair
_supported_fs btrfs
_require_scratch_dev_pool 3
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_odirect
# Overwriting data is forbidden on a zoned block device
_require_non_zoned_device "${SCRATCH_DEV}"
diff --git a/tests/btrfs/268 b/tests/btrfs/268
index 9dc14a18..d122ee36 100755
--- a/tests/btrfs/268
+++ b/tests/btrfs/268
@@ -16,6 +16,8 @@ _begin_fstest auto quick read_repair
_supported_fs btrfs
_require_scratch
_require_odirect
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_non_zoned_device "${SCRATCH_DEV}" # no overwrites on zoned devices
_require_scratch_dev_pool 2
_scratch_dev_pool_get 2
diff --git a/tests/btrfs/269 b/tests/btrfs/269
index ad8f7286..7ffad125 100755
--- a/tests/btrfs/269
+++ b/tests/btrfs/269
@@ -20,6 +20,8 @@ _begin_fstest auto quick read_repair
_supported_fs btrfs
_require_scratch
_require_odirect
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_non_zoned_device "${SCRATCH_DEV}" # no overwrites on zoned devices
_require_scratch_dev_pool 4
_scratch_dev_pool_get 4
diff --git a/tests/btrfs/289 b/tests/btrfs/289
index 39d8f733..f1aaf4cc 100755
--- a/tests/btrfs/289
+++ b/tests/btrfs/289
@@ -16,6 +16,8 @@ _begin_fstest auto quick scrub repair
# Modify as appropriate.
_supported_fs btrfs
_require_scratch
+# No data checksums for NOCOW case, so can't detect corruption and repair data.
+_require_btrfs_no_nodatacow
_require_odirect
# Overwriting data is forbidden on a zoned block device
--
2.40.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] btrfs/173: make the test work when mounting with nodatacow
2024-02-01 18:03 ` [PATCH 2/4] btrfs/173: make the test work when mounting with nodatacow fdmanana
@ 2024-02-05 12:26 ` David Disseldorp
0 siblings, 0 replies; 7+ messages in thread
From: David Disseldorp @ 2024-02-05 12:26 UTC (permalink / raw)
To: fdmanana; +Cc: fstests, linux-btrfs, Filipe Manana
On Thu, 1 Feb 2024 18:03:48 +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> Currently btrfs/173 fails when passing "-o nodatacow" to MOUNT_OPTIONS
> because it assumes that when creating a file it does not have the
> nodatacow flag set, which is obviously not true if the fs is mounted with
> "-o nodatacow". To allow the test to run successfully with nodatacow,
> just make sure it clears the nodatacow flag from the file if the fs was
> mounted with "-o nodatacow".
>
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
> ---
> tests/btrfs/173 | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tests/btrfs/173 b/tests/btrfs/173
> index 6e78a826..42af2d26 100755
> --- a/tests/btrfs/173
> +++ b/tests/btrfs/173
> @@ -23,6 +23,11 @@ echo "COW file"
> # unset it after the swap file has been created.
> rm -f "$SCRATCH_MNT/swap"
> touch "$SCRATCH_MNT/swap"
> +# Make sure we have a COW file if we were mounted with "-o nodatacow".
> +if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "nodatacow"; then
> + _require_chattr C
> + $CHATTR_PROG -C "$SCRATCH_MNT/swap"
> +fi
Nit: _format_swapfile already calls $CHATTR_PROG +C, so might as well
put the _require_chattr call alongside _require_scratch_swapfile
> chmod 0600 "$SCRATCH_MNT/swap"
> _pwrite_byte 0x61 0 $(($(_get_page_size) * 10)) "$SCRATCH_MNT/swap" >> $seqres.full
> $MKSWAP_PROG "$SCRATCH_MNT/swap" >> $seqres.full
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow
2024-02-01 18:03 [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow fdmanana
` (3 preceding siblings ...)
2024-02-01 18:03 ` [PATCH 4/4] btrfs: require no nodatacow for tests that exercise read repair fdmanana
@ 2024-02-05 12:29 ` David Disseldorp
4 siblings, 0 replies; 7+ messages in thread
From: David Disseldorp @ 2024-02-05 12:29 UTC (permalink / raw)
To: fdmanana; +Cc: fstests, linux-btrfs, Filipe Manana
On Thu, 1 Feb 2024 18:03:46 +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> Several test btrfs test cases fail when using "-o nodatacow" in MOUNT_OPTIONS.
> So fix that by either adapting the tests to pass or skip them if there's no
> way for them to succeed in nodatacow mode.
>
> Filipe Manana (4):
> btrfs: require no nodatacow for tests that exercise compression
> btrfs/173: make the test work when mounting with nodatacow
> btrfs/299: skip test if we were mounted with nodatacow
> btrfs: require no nodatacow for tests that exercise read repair
The double negative hurts my eyes, but these all look fine to me (one
minor nit in 2/4).
Reviewed-by: David Disseldorp <ddiss@suse.de>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-02-05 12:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-01 18:03 [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow fdmanana
2024-02-01 18:03 ` [PATCH 1/4] btrfs: require no nodatacow for tests that exercise compression fdmanana
2024-02-01 18:03 ` [PATCH 2/4] btrfs/173: make the test work when mounting with nodatacow fdmanana
2024-02-05 12:26 ` David Disseldorp
2024-02-01 18:03 ` [PATCH 3/4] btrfs/299: skip test if we were mounted " fdmanana
2024-02-01 18:03 ` [PATCH 4/4] btrfs: require no nodatacow for tests that exercise read repair fdmanana
2024-02-05 12:29 ` [PATCH 0/4] btrfs: make test pass or skip them when using nodatacow David Disseldorp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox