diff options
author | Johannes Thumshirn <johannes.thumshirn@wdc.com> | 2024-02-27 13:25:31 +0100 |
---|---|---|
committer | Zorro Lang <zlang@kernel.org> | 2024-03-01 19:22:36 +0800 |
commit | 8c9102789fecb8a393dfa6a7ee1390a26f262c62 (patch) | |
tree | 3dbcfb59447bd920fe622036ce4c12735fb63fe7 | |
parent | fe6326040eb35069396d6f139bf548d8100cee9f (diff) | |
download | xfstests-dev-8c9102789fecb8a393dfa6a7ee1390a26f262c62.tar.gz |
btrfs: check conversion of zoned fileystems
Recently we had a bug where a zoned filesystem could be converted to a
higher data redundancy profile than supported.
Add a test-case to check the conversion on zoned filesystems.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
-rwxr-xr-x | tests/btrfs/317 | 67 | ||||
-rw-r--r-- | tests/btrfs/317.out | 9 |
2 files changed, 76 insertions, 0 deletions
diff --git a/tests/btrfs/317 b/tests/btrfs/317 new file mode 100755 index 0000000000..59686b7277 --- /dev/null +++ b/tests/btrfs/317 @@ -0,0 +1,67 @@ +#! /bin/bash +# SPDX-License-Identifier: GPL-2.0 +# Copyright (c) 2024 Western Digital Corporation. All Rights Reserved. +# +# FS QA Test 317 +# +# Test that btrfs convert can ony be run to convert to supported profiles on a +# zoned filesystem +# +. ./common/preamble +_begin_fstest auto volume raid convert + +_fixed_by_kernel_commit XXXXXXXXXX \ + "btrfs: zoned: don't skip block group profile checks on conv zones" + +. common/filter.btrfs + +_supported_fs btrfs +_require_scratch_dev_pool 4 +_require_zoned_device "$SCRATCH_DEV" + +devs=( $SCRATCH_DEV_POOL ) + +# Create and mount single device FS +_scratch_mkfs -msingle -dsingle 2>&1 >> $seqres.full || _fail "mkfs failed" +_scratch_mount + +# Convert FS to metadata/system DUP +_run_btrfs_balance_start -f -mconvert=dup -sconvert=dup $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert + +# Convert FS to data DUP, must fail +_run_btrfs_balance_start -dconvert=dup $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert + +# Add device +$BTRFS_UTIL_PROG device add ${devs[1]} $SCRATCH_MNT | _filter_device_add + +# Convert FS to data RAID1, must fail +_run_btrfs_balance_start -dconvert=raid1 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Convert FS to data RAID0, must fail +_run_btrfs_balance_start -dconvert=raid0 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Add device +$BTRFS_UTIL_PROG device add ${devs[2]} $SCRATCH_MNT | _filter_device_add + +# Convert FS to data RAID5, must fail +_run_btrfs_balance_start -f -dconvert=raid5 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Add device +$BTRFS_UTIL_PROG device add ${devs[3]} $SCRATCH_MNT | _filter_device_add + +# Convert FS to data RAID10, must fail +_run_btrfs_balance_start -dconvert=raid10 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# Convert FS to data RAID6, must fail +_run_btrfs_balance_start -f -dconvert=raid6 $SCRATCH_MNT 2>&1 |\ + _filter_balance_convert | head -1 + +# success, all done +status=0 +exit diff --git a/tests/btrfs/317.out b/tests/btrfs/317.out new file mode 100644 index 0000000000..82b00d293d --- /dev/null +++ b/tests/btrfs/317.out @@ -0,0 +1,9 @@ +QA output created by 317 +Done, had to relocate X out of X chunks +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +There may be more info in syslog - try dmesg | tail +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument |