[PATCH 3/4] btrfs/299: skip test if we were mounted with nodatacow

fdmanana
2024-02-01T18:04:09Z

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