diff options
author | Filipe Manana <fdmanana@suse.com> | 2024-02-01 18:03:48 +0000 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2024-03-01 19:24:16 +0800 |
commit | 45d779c9d241bdc1cb1d2761fe23f55251c09dde (patch) | |
tree | 854d1c1a880e4a9c3268c99288fc00d54c5da8f9 | |
parent | 15c084fe1137fedf870e4947ed259a89f1e9c62e (diff) | |
download | xfstests-dev-45d779c9d241bdc1cb1d2761fe23f55251c09dde.tar.gz |
btrfs/173: make the test work when mounting with nodatacow
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>
Reviewed-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
-rwxr-xr-x | tests/btrfs/173 | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/btrfs/173 b/tests/btrfs/173 index 6e78a82647..42af2d2663 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 |