diff mbox series

[5/8] btrfs/205: avoid test failure when running with nodatasum mount option

Message ID d30273c05a30b3d177277a05e82c52a998779907.1739379185.git.fdmanana@suse.com (mailing list archive)
State New
Headers show
Series fstests: btrfs: fix test failure when running with compression or nodatasum | expand

Commit Message

Filipe Manana Feb. 12, 2025, 5:01 p.m. UTC
From: Filipe Manana <fdmanana@suse.com>

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.

Signed-off-by: Filipe Manana <fdmanana@suse.com>
---
 tests/btrfs/205 | 2 --
 1 file changed, 2 deletions(-)

Comments

David Sterba Feb. 12, 2025, 11:20 p.m. UTC | #1
On Wed, Feb 12, 2025 at 05:01:53PM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> 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.
> 
> Signed-off-by: Filipe Manana <fdmanana@suse.com>

Reviewed-by: David Sterba <dsterba@suse.com>
diff mbox series

Patch

diff --git a/tests/btrfs/205 b/tests/btrfs/205
index 13a1df8b..71522492 100755
--- a/tests/btrfs/205
+++ b/tests/btrfs/205
@@ -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" \