fstests: btrfs: fix test failure when running with compression or nodatasum
cover fstests: btrfs: fix test failure when running with compression or nodatasum
From: Filipe Manana <[email protected]>
Several tests fail when running with the compression or nodatasum mount options. This patchset fixes that by either skipping the tests when those mount options are present or adapting the tests to able to run. Details in the changelogs.
Filipe Manana (8):
btrfs: skip tests incompatible with compression when compression is enabled btrfs/290: skip test if we are running with nodatacow mount option common/btrfs: add a _require_btrfs_no_nodatasum helper btrfs/333: skip the test when running with nodatacow or nodatasum btrfs/205: avoid test failure when running with nodatasum mount option
btrfs: skip tests exercising data corruption and repair when using nodatasum btrfs/281: skip test when running with nodatasum mount option
btrfs: skip tests that exercise compression property when using nodatasum
common/btrfs | 7 +++++++ tests/btrfs/048 | 3 +++ tests/btrfs/059 | 3 +++ tests/btrfs/140 | 4 +++- tests/btrfs/141 | 4 +++- tests/btrfs/157 | 4 +++- tests/btrfs/158 | 4 +++- tests/btrfs/205 | 2 -- tests/btrfs/215 | 8 +++++++- tests/btrfs/265 | 7 ++++++- tests/btrfs/266 | 7 ++++++- tests/btrfs/267 | 7 ++++++- tests/btrfs/268 | 7 ++++++- tests/btrfs/269 | 7 ++++++- tests/btrfs/281 | 2 ++ tests/btrfs/289 | 8 ++++++-- tests/btrfs/290 | 12 ++++++++++++ tests/btrfs/297 | 4 ++++ tests/btrfs/333 | 5 +++++ 19 files changed, 91 insertions(+), 14 deletions(-)
Signature · 1 line
2.45.2
PATCH 1/8 btrfs: skip tests incompatible with compression when compression is enabled
From: Filipe Manana <[email protected]>
We have several tests that fail when compression is enabled (MOUNT_OPTIONS has "-o compress" or "-o compress-force"") because they expect a fixed extent size and they trigger corruption by writing directly to a device, therefore making them incompatible with compression.
So add a _require_no_compress call to them.
--- tests/btrfs/215 | 4 ++++ tests/btrfs/265 | 3 +++ tests/btrfs/266 | 3 +++ tests/btrfs/267 | 3 +++ tests/btrfs/268 | 3 +++ tests/btrfs/269 | 3 +++ tests/btrfs/289 | 4 +++- tests/btrfs/297 | 4 ++++ 8 files changed, 26 insertions(+), 1 deletion(-)
tests/btrfs/215 +4 -0
@@ -25,6 +25,10 @@ _require_scratch _require_btrfs_no_nodatacow # Overwriting data is forbidden on a zoned block device _require_non_zoned_device $SCRATCH_DEV +# We need to ensure a fixed amount of written blocks to trigger a specific +# number of read errors and we corrupt by writing directly to the device, so +# skip if compression is enabled. +_require_no_compress _scratch_mkfs > /dev/null # disable freespace inode to ensure file is the first thing in the data
tests/btrfs/265 +3 -0
@@ -20,6 +20,9 @@ _require_btrfs_no_nodatacow _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _scratch_dev_pool_get 3 # step 1, create a raid1 btrfs which contains one 128k file.
tests/btrfs/266 +3 -0
@@ -21,6 +21,9 @@ _require_scratch_dev_pool 3 _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _scratch_dev_pool_get 3 # step 1, create a raid1 btrfs which contains one 128k file.
tests/btrfs/267 +3 -0
@@ -21,6 +21,9 @@ _require_btrfs_no_nodatacow _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _scratch_dev_pool_get 3 # step 1, create a raid1 btrfs which contains one 128k file.
tests/btrfs/268 +3 -0
@@ -20,6 +20,9 @@ _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 +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress echo "step 1......mkfs.btrfs"
tests/btrfs/269 +3 -0
@@ -22,6 +22,9 @@ _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 +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _require_scratch_dev_pool 4 _scratch_dev_pool_get 4
tests/btrfs/289 +3 -1
@@ -18,7 +18,9 @@ _require_btrfs_no_nodatacow _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" - +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress # The errors reported would be in the unit of sector, thus the number # is dependent on the sectorsize. _require_btrfs_support_sectorsize 4096
tests/btrfs/297 +4 -0
@@ -14,6 +14,10 @@ _begin_fstest auto quick raid scrub _require_odirect _require_non_zoned_device "${SCRATCH_DEV}" _require_scratch_dev_pool 3 +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress + _fixed_by_kernel_commit 486c737f7fdc \ "btrfs: raid56: always verify the P/Q contents for scrub"
Signature · 1 line
2.45.2
Re: [PATCH 1/8] btrfs: skip tests incompatible with compression when compression is enabled
Looks good,
PATCH 2/8 btrfs/290: skip test if we are running with nodatacow mount option
In reply to [email protected]From: Filipe Manana <[email protected]>
We exercise corrupting an inline extent and inline extents can't be created with nodatacow, we get instead a regular file extent item and if we attempt to corrupt its disk_bytenr field with btrfs-corrupt-block we fail tree-checker validation at mount time resulting in failure to mount and the following in dmesg:
[514127.759739] BTRFS critical (device sdc): corrupt leaf: root=5 \
block=30408704 slot=8 ino=257 file_offset=0, invalid disk_bytenr for \
file extent, have 7416089308958521981, should be aligned to 4096
[514127.762715] BTRFS error (device sdc): read time tree block corruption \
detected on logical 30408704 mirror 1So add a _require_btrfs_no_nodatacow call to the test.
--- tests/btrfs/290 | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tests/btrfs/290 +12 -0
@@ -30,6 +30,18 @@ _require_xfs_io_command "pread" _require_xfs_io_command "pwrite" _require_btrfs_corrupt_block "value" _require_btrfs_corrupt_block "offset" +# We exercise corrupting an inline extent and inline extents can't be created +# with nodatacow, we get instead a regular file extent item and if we attempt +# to corrupt its disk_bytenr field with btrfs-corrupt-block we fail tree-checker +# validation at mount time resulting in failure to mount and the following in +# dmesg: +# +# [514127.759739] BTRFS critical (device sdc): corrupt leaf: root=5 \ +# block=30408704 slot=8 ino=257 file_offset=0, invalid disk_bytenr for \ +# file extent, have 7416089308958521981, should be aligned to 4096 +# [514127.762715] BTRFS error (device sdc): read time tree block corruption \ +# detected on logical 30408704 mirror 1 +_require_btrfs_no_nodatacow _disable_fsverity_signatures get_ino() {
Signature · 1 line
2.45.2
Re: [PATCH 2/8] btrfs/290: skip test if we are running with nodatacow mount option
Looks good,
PATCH 3/8 common/btrfs: add a _require_btrfs_no_nodatasum helper
In reply to [email protected]From: Filipe Manana <[email protected]>
Add a _require_btrfs_no_nodatasum helper to skip a test if the nodatasum mount option is give, as we do have several tests that fail, for several reasons, when that mount option is passed.
--- common/btrfs | 7 +++++++ 1 file changed, 7 insertions(+)
common/btrfs +7 -0
@@ -134,6 +134,13 @@ _require_btrfs_no_nodatacow() fi } +_require_btrfs_no_nodatasum() +{ + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "nodatasum"; then + _notrun "This test requires no nodatasum enabled" + fi +} + _require_btrfs_free_space_tree() { _scratch_mkfs > /dev/null 2>&1
Signature · 1 line
2.45.2
Re: [PATCH 3/8] common/btrfs: add a _require_btrfs_no_nodatasum helper
All those double negations XD
PATCH 4/8 btrfs/333: skip the test when running with nodatacow or nodatasum
In reply to [email protected]From: Filipe Manana <[email protected]>
Encoded writes are reject for inodes with the NODATASUM flag, so we must skip the test if running with either the nodatasum or nodatacow (which implies nodatasum) mount options.
So skip the test when under nodatacow and nodatasum mount options.
--- tests/btrfs/333 | 5 +++++ 1 file changed, 5 insertions(+)
tests/btrfs/333 +5 -0
@@ -14,6 +14,11 @@ _begin_fstest auto quick compress rw io_uring ioctl _require_command src/btrfs_encoded_read _require_command src/btrfs_encoded_write _require_btrfs_iouring_encoded_read +# Encoded writes are reject for inodes with the NODATASUM flag, so we must skip +# the test if running with either the nodatasum or nodatacow (which implies +# nodatasum) mount options. +_require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum do_encoded_read() {
Signature · 1 line
2.45.2
Re: [PATCH 4/8] btrfs/333: skip the test when running with nodatacow or nodatasum
Looks good,
PATCH 5/8 btrfs/205: avoid test failure when running with nodatasum mount option
In reply to [email protected]From: Filipe Manana <[email protected]>
Currently the test fails when we pass "-o nodatasum" in MOUNT_OPTIONS and the reason is because we enable compression, with "chattr +c", on a file and then try to clone from it to a file with nodatasum inherited from the mount options, which results in the clone ioctl to fail with -EINVAL since it's not possible to clone from datasum to nodatasum and vice-versa.
Fix this by removing the "chattr +c", as it's not needed and we already exercise the compression scenario by explicitly cycle mounting the scratch device with "-o compress". This also allows us to exercise cloning the "foo1" file without compression. I originally added the "chattr +c" call but this was probably an oversight while debugging something.
--- tests/btrfs/205 | 2 -- 1 file changed, 2 deletions(-)
tests/btrfs/205 +0 -2
@@ -21,7 +21,6 @@ _begin_fstest auto quick clone compress prealloc _require_scratch_reflink _require_xfs_io_command "falloc" "-k" -_require_command "$CHATTR_PROG" chattr _require_btrfs_fs_feature "no_holes" _require_btrfs_mkfs_feature "no-holes"
@@ -33,7 +32,6 @@ run_tests() # extent. It has a file size of 128K. echo "Creating file foo1" touch $SCRATCH_MNT/foo1 - $CHATTR_PROG +c $SCRATCH_MNT/foo1 > /dev/null 2>&1 $XFS_IO_PROG -c "pwrite -S 0xab 0 4K" \ -c "fsync" \ -c "pwrite -S 0xab 4K 124K" \
Signature · 1 line
2.45.2
Re: [PATCH 5/8] btrfs/205: avoid test failure when running with nodatasum mount option
Quoted 8 lines · On Wed, Feb 12, 2025 at 05:01:53PM +0000, [email protected] wrote:
From: Filipe Manana <[email protected]>
Currently the test fails when we pass "-o nodatasum" in
MOUNT_OPTIONSand the reason is because we enable compression, with "chattr +c", on a file and then try to clone from it to a file with nodatasum inherited from the mount options, which results in the clone ioctl to fail with-EINVALsince it's not possible to clone from datasum to nodatasum and vice-versa.
Quoted 7 lines
Fix this by removing the "chattr +c", as it's not needed and we already exercise the compression scenario by explicitly cycle mounting the scratch device with "-o compress". This also allows us to exercise cloning the "foo1" file without compression. I originally added the "chattr +c" call but this was probably an oversight while debugging something.
Signed-off-by Filipe Manana <[email protected]>
PATCH 6/8 btrfs: skip tests exercising data corruption and repair when using nodatasum
In reply to [email protected]From: Filipe Manana <[email protected]>
Several tests exercise corrupting data and then checking that on read the data is repaired, but this requires using checksums, so the tests fail when running with the nodatasum mount option.
So add a _require_btrfs_no_nodatasum call to these tests.
--- tests/btrfs/140 | 4 +++- tests/btrfs/141 | 4 +++- tests/btrfs/157 | 4 +++- tests/btrfs/158 | 4 +++- tests/btrfs/215 | 4 +++- tests/btrfs/265 | 4 +++- tests/btrfs/266 | 4 +++- tests/btrfs/267 | 4 +++- tests/btrfs/268 | 4 +++- tests/btrfs/269 | 4 +++- tests/btrfs/289 | 4 +++- 11 files changed, 33 insertions(+), 11 deletions(-)
tests/btrfs/140 +3 -1
@@ -17,8 +17,10 @@ _begin_fstest auto quick read_repair fiemap . ./common/filter _require_scratch_dev_pool 2 -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_btrfs_command inspect-internal dump-tree _require_odirect # Overwriting data is forbidden on a zoned block device
tests/btrfs/141 +3 -1
@@ -17,8 +17,10 @@ _begin_fstest auto quick read_repair . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 2 _require_btrfs_command inspect-internal dump-tree
tests/btrfs/157 +3 -1
@@ -25,8 +25,10 @@ _begin_fstest auto quick raid read_repair . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 4 _require_btrfs_command inspect-internal dump-tree _require_btrfs_raid_type raid6
tests/btrfs/158 +3 -1
@@ -17,8 +17,10 @@ _begin_fstest auto quick raid scrub . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 4 _require_btrfs_command inspect-internal dump-tree _require_btrfs_raid_type raid5
tests/btrfs/215 +3 -1
@@ -21,8 +21,10 @@ get_physical() } _require_scratch -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum # Overwriting data is forbidden on a zoned block device _require_non_zoned_device $SCRATCH_DEV # We need to ensure a fixed amount of written blocks to trigger a specific
tests/btrfs/265 +3 -1
@@ -15,8 +15,10 @@ _begin_fstest auto quick read_repair _require_scratch_dev_pool 3 -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}"
tests/btrfs/266 +3 -1
@@ -14,8 +14,10 @@ _begin_fstest auto quick read_repair . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 3 _require_odirect
tests/btrfs/267 +3 -1
@@ -16,8 +16,10 @@ _begin_fstest auto quick read_repair _require_scratch_dev_pool 3 -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}"
tests/btrfs/268 +3 -1
@@ -15,8 +15,10 @@ _begin_fstest auto quick read_repair _require_scratch _require_odirect -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_non_zoned_device "${SCRATCH_DEV}" # no overwrites on zoned devices _require_scratch_dev_pool 2 _scratch_dev_pool_get 2
tests/btrfs/269 +3 -1
@@ -19,8 +19,10 @@ _begin_fstest auto quick read_repair _require_scratch _require_odirect -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_non_zoned_device "${SCRATCH_DEV}" # no overwrites on zoned devices # We need to ensure a fixed extent size and we corrupt by writing directly to # the device, so skip if compression is enabled.
tests/btrfs/289 +3 -1
@@ -12,8 +12,10 @@ _begin_fstest auto quick scrub repair . ./common/filter _require_scratch -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_odirect # Overwriting data is forbidden on a zoned block device
Signature · 1 line
2.45.2
PATCH 7/8 btrfs/281: skip test when running with nodatasum mount option
In reply to [email protected]From: Filipe Manana <[email protected]>
The test exercises compression and compression doesn't happen on inodes with checksums disabled (nodatasum), making the test fail the expectations if getting compressed extents. So skip the test if nodatasum is present.
--- tests/btrfs/281 | 2 ++ 1 file changed, 2 insertions(+)
tests/btrfs/281 +2 -0
@@ -25,6 +25,8 @@ _require_btrfs_send_version 2 _require_xfs_io_command "fiemap" _require_fssum _require_btrfs_no_nodatacow +# Compression can't happen with nodatasum, so skip the test. +_require_btrfs_no_nodatasum _fixed_by_kernel_commit a11452a3709e \ "btrfs: send: avoid unaligned encoded writes when attempting to clone range"
Signature · 1 line
2.45.2
Re: [PATCH 7/8] btrfs/281: skip test when running with nodatasum mount option
Quoted 7 lines · On Wed, Feb 12, 2025 at 05:01:55PM +0000, [email protected] wrote:
From: Filipe Manana <[email protected]>
The test exercises compression and compression doesn't happen on inodes with checksums disabled (nodatasum), making the test fail the expectations if getting compressed extents. So skip the test if nodatasum is present.
Signed-off-by Filipe Manana <[email protected]>
PATCH 8/8 btrfs: skip tests that exercise compression property when using nodatasum
In reply to [email protected]From: Filipe Manana <[email protected]>
A couple tests exercise the compression property and that fails when an inode has the nodatasum flag set. So skip the tests when running under the nodatasum mount option.
--- tests/btrfs/048 | 3 +++ tests/btrfs/059 | 3 +++ 2 files changed, 6 insertions(+)
tests/btrfs/048 +3 -0
@@ -28,6 +28,9 @@ _require_scratch _require_btrfs_command "property" _require_btrfs_command inspect-internal dump-super _require_btrfs_no_nodatacow +# We exercise setting compression through properties, and that fails on inodes +# with nodatasum, so skip when mounting with nodatasum. +_require_btrfs_no_nodatasum send_files_dir=$TEST_DIR/btrfs-test-$seq
tests/btrfs/059 +3 -0
@@ -26,6 +26,9 @@ _require_test _require_scratch _require_btrfs_command "property" _require_btrfs_no_nodatacow +# We exercise setting compression through properties, and that fails on inodes +# with nodatasum, so skip when mounting with nodatasum. +_require_btrfs_no_nodatasum _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount
Signature · 1 line
2.45.2
Re: [PATCH 8/8] btrfs: skip tests that exercise compression property when using nodatasum
Quoted 7 lines · On Wed, Feb 12, 2025 at 05:01:56PM +0000, [email protected] wrote:
From: Filipe Manana <[email protected]>
A couple tests exercise the compression property and that fails when an inode has the nodatasum flag set. So skip the tests when running under the nodatasum mount option.
Signed-off-by Filipe Manana <[email protected]>
v2 cover fstests: btrfs: fix test failures when running with compression or nodatasum
In reply to [email protected]From: Filipe Manana <[email protected]>
Several tests fail when running with the compression or nodatasum mount options. This patchset fixes that by either skipping the tests when those mount options are present or adapting the tests to able to run. Details in the changelogs.
V2: Updated patch 5/8, the chattr must stay as we really want to create
an inline compressed extent, otherwise it wouldn't be exercising cloning of an inline extent. So skip the test instead of nodatasum is present and add a comment about it.
Added some collect review tags.
Filipe Manana (8):
btrfs: skip tests incompatible with compression when compression is enabled btrfs/290: skip test if we are running with nodatacow mount option common/btrfs: add a _require_btrfs_no_nodatasum helper btrfs/333: skip the test when running with nodatacow or nodatasum btrfs/205: skip test when running with nodatasum mount option
btrfs: skip tests exercising data corruption and repair when using nodatasum btrfs/281: skip test when running with nodatasum mount option
btrfs: skip tests that exercise compression property when using nodatasum
common/btrfs | 7 +++++++ tests/btrfs/048 | 3 +++ tests/btrfs/059 | 3 +++ tests/btrfs/140 | 4 +++- tests/btrfs/141 | 4 +++- tests/btrfs/157 | 4 +++- tests/btrfs/158 | 4 +++- tests/btrfs/205 | 5 +++++ tests/btrfs/215 | 8 +++++++- tests/btrfs/265 | 7 ++++++- tests/btrfs/266 | 7 ++++++- tests/btrfs/267 | 7 ++++++- tests/btrfs/268 | 7 ++++++- tests/btrfs/269 | 7 ++++++- tests/btrfs/281 | 2 ++ tests/btrfs/289 | 8 ++++++-- tests/btrfs/290 | 12 ++++++++++++ tests/btrfs/297 | 4 ++++ tests/btrfs/333 | 5 +++++ 19 files changed, 96 insertions(+), 12 deletions(-)
Signature · 1 line
2.45.2
PATCH v2 1/8 btrfs: skip tests incompatible with compression when compression is enabled
From: Filipe Manana <[email protected]>
We have several tests that fail when compression is enabled (MOUNT_OPTIONS has "-o compress" or "-o compress-force"") because they expect a fixed extent size and they trigger corruption by writing directly to a device, therefore making them incompatible with compression.
So add a _require_no_compress call to them.
--- tests/btrfs/215 | 4 ++++ tests/btrfs/265 | 3 +++ tests/btrfs/266 | 3 +++ tests/btrfs/267 | 3 +++ tests/btrfs/268 | 3 +++ tests/btrfs/269 | 3 +++ tests/btrfs/289 | 4 +++- tests/btrfs/297 | 4 ++++ 8 files changed, 26 insertions(+), 1 deletion(-)
tests/btrfs/215 +4 -0
@@ -25,6 +25,10 @@ _require_scratch _require_btrfs_no_nodatacow # Overwriting data is forbidden on a zoned block device _require_non_zoned_device $SCRATCH_DEV +# We need to ensure a fixed amount of written blocks to trigger a specific +# number of read errors and we corrupt by writing directly to the device, so +# skip if compression is enabled. +_require_no_compress _scratch_mkfs > /dev/null # disable freespace inode to ensure file is the first thing in the data
tests/btrfs/265 +3 -0
@@ -20,6 +20,9 @@ _require_btrfs_no_nodatacow _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _scratch_dev_pool_get 3 # step 1, create a raid1 btrfs which contains one 128k file.
tests/btrfs/266 +3 -0
@@ -21,6 +21,9 @@ _require_scratch_dev_pool 3 _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _scratch_dev_pool_get 3 # step 1, create a raid1 btrfs which contains one 128k file.
tests/btrfs/267 +3 -0
@@ -21,6 +21,9 @@ _require_btrfs_no_nodatacow _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _scratch_dev_pool_get 3 # step 1, create a raid1 btrfs which contains one 128k file.
tests/btrfs/268 +3 -0
@@ -20,6 +20,9 @@ _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 +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress echo "step 1......mkfs.btrfs"
tests/btrfs/269 +3 -0
@@ -22,6 +22,9 @@ _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 +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress _require_scratch_dev_pool 4 _scratch_dev_pool_get 4
tests/btrfs/289 +3 -1
@@ -18,7 +18,9 @@ _require_btrfs_no_nodatacow _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}" - +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress # The errors reported would be in the unit of sector, thus the number # is dependent on the sectorsize. _require_btrfs_support_sectorsize 4096
tests/btrfs/297 +4 -0
@@ -14,6 +14,10 @@ _begin_fstest auto quick raid scrub _require_odirect _require_non_zoned_device "${SCRATCH_DEV}" _require_scratch_dev_pool 3 +# We need to ensure a fixed extent size and we corrupt by writing directly to +# the device, so skip if compression is enabled. +_require_no_compress + _fixed_by_kernel_commit 486c737f7fdc \ "btrfs: raid56: always verify the P/Q contents for scrub"
Signature · 1 line
2.45.2
PATCH v2 2/8 btrfs/290: skip test if we are running with nodatacow mount option
In reply to [email protected]From: Filipe Manana <[email protected]>
We exercise corrupting an inline extent and inline extents can't be created with nodatacow, we get instead a regular file extent item and if we attempt to corrupt its disk_bytenr field with btrfs-corrupt-block we fail tree-checker validation at mount time resulting in failure to mount and the following in dmesg:
[514127.759739] BTRFS critical (device sdc): corrupt leaf: root=5 \
block=30408704 slot=8 ino=257 file_offset=0, invalid disk_bytenr for \
file extent, have 7416089308958521981, should be aligned to 4096
[514127.762715] BTRFS error (device sdc): read time tree block corruption \
detected on logical 30408704 mirror 1So add a _require_btrfs_no_nodatacow call to the test.
--- tests/btrfs/290 | 12 ++++++++++++ 1 file changed, 12 insertions(+)
tests/btrfs/290 +12 -0
@@ -30,6 +30,18 @@ _require_xfs_io_command "pread" _require_xfs_io_command "pwrite" _require_btrfs_corrupt_block "value" _require_btrfs_corrupt_block "offset" +# We exercise corrupting an inline extent and inline extents can't be created +# with nodatacow, we get instead a regular file extent item and if we attempt +# to corrupt its disk_bytenr field with btrfs-corrupt-block we fail tree-checker +# validation at mount time resulting in failure to mount and the following in +# dmesg: +# +# [514127.759739] BTRFS critical (device sdc): corrupt leaf: root=5 \ +# block=30408704 slot=8 ino=257 file_offset=0, invalid disk_bytenr for \ +# file extent, have 7416089308958521981, should be aligned to 4096 +# [514127.762715] BTRFS error (device sdc): read time tree block corruption \ +# detected on logical 30408704 mirror 1 +_require_btrfs_no_nodatacow _disable_fsverity_signatures get_ino() {
Signature · 1 line
2.45.2
PATCH v2 3/8 common/btrfs: add a _require_btrfs_no_nodatasum helper
In reply to [email protected]From: Filipe Manana <[email protected]>
Add a _require_btrfs_no_nodatasum helper to skip a test if the nodatasum mount option is give, as we do have several tests that fail, for several reasons, when that mount option is passed.
--- common/btrfs | 7 +++++++ 1 file changed, 7 insertions(+)
common/btrfs +7 -0
@@ -134,6 +134,13 @@ _require_btrfs_no_nodatacow() fi } +_require_btrfs_no_nodatasum() +{ + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "nodatasum"; then + _notrun "This test requires no nodatasum enabled" + fi +} + _require_btrfs_free_space_tree() { _scratch_mkfs > /dev/null 2>&1
Signature · 1 line
2.45.2
PATCH v2 4/8 btrfs/333: skip the test when running with nodatacow or nodatasum
In reply to [email protected]From: Filipe Manana <[email protected]>
Encoded writes are reject for inodes with the NODATASUM flag, so we must skip the test if running with either the nodatasum or nodatacow (which implies nodatasum) mount options.
So skip the test when under nodatacow and nodatasum mount options.
--- tests/btrfs/333 | 5 +++++ 1 file changed, 5 insertions(+)
tests/btrfs/333 +5 -0
@@ -14,6 +14,11 @@ _begin_fstest auto quick compress rw io_uring ioctl _require_command src/btrfs_encoded_read _require_command src/btrfs_encoded_write _require_btrfs_iouring_encoded_read +# Encoded writes are reject for inodes with the NODATASUM flag, so we must skip +# the test if running with either the nodatasum or nodatacow (which implies +# nodatasum) mount options. +_require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum do_encoded_read() {
Signature · 1 line
2.45.2
PATCH v2 5/8 btrfs/205: skip test when running with nodatasum mount option
In reply to [email protected]From: Filipe Manana <[email protected]>
Currently the test fails when we pass "-o nodatasum" in MOUNT_OPTIONS and the reason is because we enable compression, with "chattr +c", on a file and then try to clone from it to a file with nodatasum inherited from the mount options, which results in the clone ioctl to fail with -EINVAL since it's not possible to clone from datasum to nodatasum and vice-versa.
So skip the test if nodatasum is a mount option.
--- tests/btrfs/205 | 5 +++++ 1 file changed, 5 insertions(+)
tests/btrfs/205 +5 -0
@@ -24,6 +24,11 @@ _require_xfs_io_command "falloc" "-k" _require_command "$CHATTR_PROG" chattr _require_btrfs_fs_feature "no_holes" _require_btrfs_mkfs_feature "no-holes" +# We want to create a compressed inline extent representing 4K of data for file +# foo1 and then clone it into a file without compression, and since compression +# implies datasum, cloning fails if the destination file has nodatasum. So skip +# the test if nodatasum is present in MOUNT_OPTIONS. +_require_btrfs_no_nodatasum run_tests() {
Signature · 1 line
2.45.2
Re: [PATCH v2 5/8] btrfs/205: skip test when running with nodatasum mount option
Looks good,
PATCH v2 6/8 btrfs: skip tests exercising data corruption and repair when using nodatasum
In reply to [email protected]From: Filipe Manana <[email protected]>
Several tests exercise corrupting data and then checking that on read the data is repaired, but this requires using checksums, so the tests fail when running with the nodatasum mount option.
So add a _require_btrfs_no_nodatasum call to these tests.
--- tests/btrfs/140 | 4 +++- tests/btrfs/141 | 4 +++- tests/btrfs/157 | 4 +++- tests/btrfs/158 | 4 +++- tests/btrfs/215 | 4 +++- tests/btrfs/265 | 4 +++- tests/btrfs/266 | 4 +++- tests/btrfs/267 | 4 +++- tests/btrfs/268 | 4 +++- tests/btrfs/269 | 4 +++- tests/btrfs/289 | 4 +++- 11 files changed, 33 insertions(+), 11 deletions(-)
tests/btrfs/140 +3 -1
@@ -17,8 +17,10 @@ _begin_fstest auto quick read_repair fiemap . ./common/filter _require_scratch_dev_pool 2 -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_btrfs_command inspect-internal dump-tree _require_odirect # Overwriting data is forbidden on a zoned block device
tests/btrfs/141 +3 -1
@@ -17,8 +17,10 @@ _begin_fstest auto quick read_repair . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 2 _require_btrfs_command inspect-internal dump-tree
tests/btrfs/157 +3 -1
@@ -25,8 +25,10 @@ _begin_fstest auto quick raid read_repair . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 4 _require_btrfs_command inspect-internal dump-tree _require_btrfs_raid_type raid6
tests/btrfs/158 +3 -1
@@ -17,8 +17,10 @@ _begin_fstest auto quick raid scrub . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 4 _require_btrfs_command inspect-internal dump-tree _require_btrfs_raid_type raid5
tests/btrfs/215 +3 -1
@@ -21,8 +21,10 @@ get_physical() } _require_scratch -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum # Overwriting data is forbidden on a zoned block device _require_non_zoned_device $SCRATCH_DEV # We need to ensure a fixed amount of written blocks to trigger a specific
tests/btrfs/265 +3 -1
@@ -15,8 +15,10 @@ _begin_fstest auto quick read_repair _require_scratch_dev_pool 3 -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}"
tests/btrfs/266 +3 -1
@@ -14,8 +14,10 @@ _begin_fstest auto quick read_repair . ./common/filter -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_scratch_dev_pool 3 _require_odirect
tests/btrfs/267 +3 -1
@@ -16,8 +16,10 @@ _begin_fstest auto quick read_repair _require_scratch_dev_pool 3 -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_odirect # Overwriting data is forbidden on a zoned block device _require_non_zoned_device "${SCRATCH_DEV}"
tests/btrfs/268 +3 -1
@@ -15,8 +15,10 @@ _begin_fstest auto quick read_repair _require_scratch _require_odirect -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_non_zoned_device "${SCRATCH_DEV}" # no overwrites on zoned devices _require_scratch_dev_pool 2 _scratch_dev_pool_get 2
tests/btrfs/269 +3 -1
@@ -19,8 +19,10 @@ _begin_fstest auto quick read_repair _require_scratch _require_odirect -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_non_zoned_device "${SCRATCH_DEV}" # no overwrites on zoned devices # We need to ensure a fixed extent size and we corrupt by writing directly to # the device, so skip if compression is enabled.
tests/btrfs/289 +3 -1
@@ -12,8 +12,10 @@ _begin_fstest auto quick scrub repair . ./common/filter _require_scratch -# No data checksums for NOCOW case, so can't detect corruption and repair data. +# No data checksums for NOCOW and NODATACOW cases, so can't detect corruption +# and repair data. _require_btrfs_no_nodatacow +_require_btrfs_no_nodatasum _require_odirect # Overwriting data is forbidden on a zoned block device
Signature · 1 line
2.45.2
Re: [PATCH v2 6/8] btrfs: skip tests exercising data corruption and repair when using nodatasum
Looks good,
PATCH v2 7/8 btrfs/281: skip test when running with nodatasum mount option
In reply to [email protected]From: Filipe Manana <[email protected]>
The test exercises compression and compression doesn't happen on inodes with checksums disabled (nodatasum), making the test fail the expectations if getting compressed extents. So skip the test if nodatasum is present.
--- tests/btrfs/281 | 2 ++ 1 file changed, 2 insertions(+)
tests/btrfs/281 +2 -0
@@ -25,6 +25,8 @@ _require_btrfs_send_version 2 _require_xfs_io_command "fiemap" _require_fssum _require_btrfs_no_nodatacow +# Compression can't happen with nodatasum, so skip the test. +_require_btrfs_no_nodatasum _fixed_by_kernel_commit a11452a3709e \ "btrfs: send: avoid unaligned encoded writes when attempting to clone range"
Signature · 1 line
2.45.2
Re: [PATCH v2 7/8] btrfs/281: skip test when running with nodatasum mount option
Looks good,
PATCH v2 8/8 btrfs: skip tests that exercise compression property when using nodatasum
In reply to [email protected]From: Filipe Manana <[email protected]>
A couple tests exercise the compression property and that fails when an inode has the nodatasum flag set. So skip the tests when running under the nodatasum mount option.
--- tests/btrfs/048 | 3 +++ tests/btrfs/059 | 3 +++ 2 files changed, 6 insertions(+)
tests/btrfs/048 +3 -0
@@ -28,6 +28,9 @@ _require_scratch _require_btrfs_command "property" _require_btrfs_command inspect-internal dump-super _require_btrfs_no_nodatacow +# We exercise setting compression through properties, and that fails on inodes +# with nodatasum, so skip when mounting with nodatasum. +_require_btrfs_no_nodatasum send_files_dir=$TEST_DIR/btrfs-test-$seq
tests/btrfs/059 +3 -0
@@ -26,6 +26,9 @@ _require_test _require_scratch _require_btrfs_command "property" _require_btrfs_no_nodatacow +# We exercise setting compression through properties, and that fails on inodes +# with nodatasum, so skip when mounting with nodatasum. +_require_btrfs_no_nodatasum _scratch_mkfs >> $seqres.full 2>&1 _scratch_mount
Signature · 1 line
2.45.2
Re: [PATCH v2 8/8] btrfs: skip tests that exercise compression property when using nodatasum
Looks good,
Re: [PATCH v2 0/8] fstests: btrfs: fix test failures when running with compression or nodatasum
In reply to [email protected]Quoted 6 lines · 在 2025/2/13 10:04, [email protected] 写道:
From: Filipe Manana <[email protected]>
Several tests fail when running with the compression or nodatasum mount options. This patchset fixes that by either skipping the tests when those mount options are present or adapting the tests to able to run. Details in the changelogs.
Thanks,
Qu
Quoted 39 lines
V2: Updated patch 5/8, the chattr must stay as we really want to create
an inline compressed extent, otherwise it wouldn't be exercising cloning of an inline extent. So skip the test instead of nodatasum is present and add a comment about it.Added some collect review tags.
Filipe Manana (8):
btrfs: skip tests incompatible with compression when compression is enabled btrfs/290: skip test if we are running with nodatacow mount option common/btrfs: add a_require_btrfs_no_nodatasumhelper btrfs/333: skip the test when running with nodatacow or nodatasum btrfs/205: skip test when running with nodatasum mount option
btrfs: skip tests exercising data corruption and repair when using nodatasum btrfs/281: skip test when running with nodatasum mount option
btrfs: skip tests that exercise compression property when using nodatasumcommon/btrfs | 7 +++++++ tests/btrfs/048 | 3 +++ tests/btrfs/059 | 3 +++ tests/btrfs/140 | 4 +++- tests/btrfs/141 | 4 +++- tests/btrfs/157 | 4 +++- tests/btrfs/158 | 4 +++- tests/btrfs/205 | 5 +++++ tests/btrfs/215 | 8 +++++++- tests/btrfs/265 | 7 ++++++- tests/btrfs/266 | 7 ++++++- tests/btrfs/267 | 7 ++++++- tests/btrfs/268 | 7 ++++++- tests/btrfs/269 | 7 ++++++- tests/btrfs/281 | 2 ++ tests/btrfs/289 | 8 ++++++-- tests/btrfs/290 | 12 ++++++++++++ tests/btrfs/297 | 4 ++++ tests/btrfs/333 | 5 +++++ 19 files changed, 96 insertions(+), 12 deletions(-)
Re: [PATCH v2 0/8] fstests: btrfs: fix test failures when running with compression or nodatasum
In reply to [email protected]Quoted 7 lines · On 13/2/25 07:34, [email protected] wrote:
From: Filipe Manana <[email protected]>
Several tests fail when running with the compression or nodatasum mount options. This patchset fixes that by either skipping the tests when those mount options are present or adapting the tests to able to run. Details in the changelogs.
Quoted 7 lines
V2: Updated patch 5/8, the chattr must stay as we really want to create
an inline compressed extent, otherwise it wouldn't be exercising cloning of an inline extent. So skip the test instead of nodatasum is present and add a comment about it.Added some collect review tags.
Looks good. Thx.
Merged.
-Anand
Quoted 31 lines
Filipe Manana (8):
btrfs: skip tests incompatible with compression when compression is enabled btrfs/290: skip test if we are running with nodatacow mount option common/btrfs: add a_require_btrfs_no_nodatasumhelper btrfs/333: skip the test when running with nodatacow or nodatasum btrfs/205: skip test when running with nodatasum mount option
btrfs: skip tests exercising data corruption and repair when using nodatasum btrfs/281: skip test when running with nodatasum mount option
btrfs: skip tests that exercise compression property when using nodatasumcommon/btrfs | 7 +++++++ tests/btrfs/048 | 3 +++ tests/btrfs/059 | 3 +++ tests/btrfs/140 | 4 +++- tests/btrfs/141 | 4 +++- tests/btrfs/157 | 4 +++- tests/btrfs/158 | 4 +++- tests/btrfs/205 | 5 +++++ tests/btrfs/215 | 8 +++++++- tests/btrfs/265 | 7 ++++++- tests/btrfs/266 | 7 ++++++- tests/btrfs/267 | 7 ++++++- tests/btrfs/268 | 7 ++++++- tests/btrfs/269 | 7 ++++++- tests/btrfs/281 | 2 ++ tests/btrfs/289 | 8 ++++++-- tests/btrfs/290 | 12 ++++++++++++ tests/btrfs/297 | 4 ++++ tests/btrfs/333 | 5 +++++ 19 files changed, 96 insertions(+), 12 deletions(-)