public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug
@ 2024-02-15 11:47 Johannes Thumshirn
  2024-02-15 11:47 ` [PATCH v3 1/3] filter.brtfs: add filter for conversion Johannes Thumshirn
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Johannes Thumshirn @ 2024-02-15 11:47 UTC (permalink / raw)
  To: Anand Jain; +Cc: Johannes Thumshirn, Zorro Lang, linux-btrfs, fstests, fdmanana

Recently we had a report, that a zoned filesystem can be converted to a
RAID although the RAID stripe tree feature was not enabled.

Add a regression test for the fix commit.

---
Johannes Thumshirn (3):
      filter.brtfs: add filter for conversion
      filter.btrfs: add filter for btrfs device add
      fstests: btrfs: check conversion of zoned fileystems

 common/filter.btrfs | 15 ++++++++++++
 tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/310.out | 12 ++++++++++
 3 files changed, 94 insertions(+)
---
base-commit: 5d761594fc5832d6d940f113b811157e332e14af
change-id: 20240215-balance-fix-6bd7998efad0

Best regards,
-- 
Johannes Thumshirn <johannes.thumshirn@wdc.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v3 1/3] filter.brtfs: add filter for conversion
  2024-02-15 11:47 [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
@ 2024-02-15 11:47 ` Johannes Thumshirn
  2024-02-15 11:47 ` [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add Johannes Thumshirn
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 13+ messages in thread
From: Johannes Thumshirn @ 2024-02-15 11:47 UTC (permalink / raw)
  To: Anand Jain; +Cc: Johannes Thumshirn, Zorro Lang, linux-btrfs, fstests, fdmanana

Add a filter for the output of btrfs-balance with a convert argument.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 common/filter.btrfs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/common/filter.btrfs b/common/filter.btrfs
index 8ab76fcb193a..ea76e7291108 100644
--- a/common/filter.btrfs
+++ b/common/filter.btrfs
@@ -141,5 +141,11 @@ _filter_stripe_tree()
 		-e "s/bytes used [0-9]+/bytes used XXXXXX/"
 }
 
+# filter output of "btrfs balance start -[smd] convert
+_filter_balance_convert()
+{
+	_filter_scratch | \
+	sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g"
+}
 # make sure this script returns success
 /bin/true

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add
  2024-02-15 11:47 [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
  2024-02-15 11:47 ` [PATCH v3 1/3] filter.brtfs: add filter for conversion Johannes Thumshirn
@ 2024-02-15 11:47 ` Johannes Thumshirn
  2024-02-26 17:16   ` Anand Jain
  2024-02-15 11:47 ` [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems Johannes Thumshirn
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Johannes Thumshirn @ 2024-02-15 11:47 UTC (permalink / raw)
  To: Anand Jain; +Cc: Johannes Thumshirn, Zorro Lang, linux-btrfs, fstests, fdmanana

Add a filter for the output of btrfs device add.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 common/filter.btrfs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/common/filter.btrfs b/common/filter.btrfs
index ea76e7291108..a1c3013ecb5d 100644
--- a/common/filter.btrfs
+++ b/common/filter.btrfs
@@ -147,5 +147,14 @@ _filter_balance_convert()
 	_filter_scratch | \
 	sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g"
 }
+
+# filter output of "btrfs device add"
+_filter_device_add()
+{
+	_filter_scratch | _filter_scratch_pool | \
+	sed -e "s/Resetting device zones SCRATCH_DEV ([0-9]\+/Resetting device zones SCRATCH_DEV (XXX/g"
+
+}
+
 # make sure this script returns success
 /bin/true

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems
  2024-02-15 11:47 [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
  2024-02-15 11:47 ` [PATCH v3 1/3] filter.brtfs: add filter for conversion Johannes Thumshirn
  2024-02-15 11:47 ` [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add Johannes Thumshirn
@ 2024-02-15 11:47 ` Johannes Thumshirn
  2024-02-27 13:12   ` Zorro Lang
  2024-02-26 11:53 ` [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
  2024-02-27 13:14 ` Zorro Lang
  4 siblings, 1 reply; 13+ messages in thread
From: Johannes Thumshirn @ 2024-02-15 11:47 UTC (permalink / raw)
  To: Anand Jain; +Cc: Johannes Thumshirn, Zorro Lang, linux-btrfs, fstests, fdmanana

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>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/btrfs/310.out | 12 ++++++++++
 2 files changed, 79 insertions(+)

diff --git a/tests/btrfs/310 b/tests/btrfs/310
new file mode 100755
index 000000000000..c39f60168f8a
--- /dev/null
+++ b/tests/btrfs/310
@@ -0,0 +1,67 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2024 Western Digital Corporation.  All Rights Reserved.
+#
+# FS QA Test 310
+#
+# Test that btrfs convert can ony be run to convert to supported profiles on a
+# zoned filesystem
+#
+. ./common/preamble
+_begin_fstest 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 > /dev/null
+_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/310.out b/tests/btrfs/310.out
new file mode 100644
index 000000000000..bc06b29ecf10
--- /dev/null
+++ b/tests/btrfs/310.out
@@ -0,0 +1,12 @@
+QA output created by 310
+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
+Resetting device zones SCRATCH_DEV (XXX zones) ...
+ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
+ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
+Resetting device zones SCRATCH_DEV (XXX zones) ...
+ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
+Resetting device zones SCRATCH_DEV (XXX zones) ...
+ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
+ERROR: error during balancing 'SCRATCH_MNT': Invalid argument

-- 
2.43.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug
  2024-02-15 11:47 [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
                   ` (2 preceding siblings ...)
  2024-02-15 11:47 ` [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems Johannes Thumshirn
@ 2024-02-26 11:53 ` Johannes Thumshirn
  2024-02-26 12:52   ` Anand Jain
  2024-02-27 13:14 ` Zorro Lang
  4 siblings, 1 reply; 13+ messages in thread
From: Johannes Thumshirn @ 2024-02-26 11:53 UTC (permalink / raw)
  To: Anand Jain
  Cc: Zorro Lang, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org,
	fdmanana@suse.com

On 15.02.24 12:47, Johannes Thumshirn wrote:
> Recently we had a report, that a zoned filesystem can be converted to a
> RAID although the RAID stripe tree feature was not enabled.
> 
> Add a regression test for the fix commit.
> 
> ---
> Johannes Thumshirn (3):
>        filter.brtfs: add filter for conversion
>        filter.btrfs: add filter for btrfs device add
>        fstests: btrfs: check conversion of zoned fileystems
> 
>   common/filter.btrfs | 15 ++++++++++++
>   tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>   tests/btrfs/310.out | 12 ++++++++++
>   3 files changed, 94 insertions(+)
> ---
> base-commit: 5d761594fc5832d6d940f113b811157e332e14af
> change-id: 20240215-balance-fix-6bd7998efad0
> 
> Best regards,

Anand, Zoro, Ping?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug
  2024-02-26 11:53 ` [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
@ 2024-02-26 12:52   ` Anand Jain
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Jain @ 2024-02-26 12:52 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Zorro Lang, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org,
	fdmanana@suse.com



On 2/26/24 17:23, Johannes Thumshirn wrote:
> On 15.02.24 12:47, Johannes Thumshirn wrote:
>> Recently we had a report, that a zoned filesystem can be converted to a
>> RAID although the RAID stripe tree feature was not enabled.
>>
>> Add a regression test for the fix commit.
>>
>> ---
>> Johannes Thumshirn (3):
>>         filter.brtfs: add filter for conversion
>>         filter.btrfs: add filter for btrfs device add
>>         fstests: btrfs: check conversion of zoned fileystems
>>
>>    common/filter.btrfs | 15 ++++++++++++
>>    tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>    tests/btrfs/310.out | 12 ++++++++++
>>    3 files changed, 94 insertions(+)
>> ---
>> base-commit: 5d761594fc5832d6d940f113b811157e332e14af
>> change-id: 20240215-balance-fix-6bd7998efad0
>>
>> Best regards,
> 
> Anand, Zoro, Ping?

Yes, I'm looking into it. I'll update you soon. Thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add
  2024-02-15 11:47 ` [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add Johannes Thumshirn
@ 2024-02-26 17:16   ` Anand Jain
  2024-02-27 11:18     ` Johannes Thumshirn
  0 siblings, 1 reply; 13+ messages in thread
From: Anand Jain @ 2024-02-26 17:16 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Zorro Lang, linux-btrfs, fstests, fdmanana

On 2/15/24 17:17, Johannes Thumshirn wrote:
> Add a filter for the output of btrfs device add.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>   common/filter.btrfs | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/common/filter.btrfs b/common/filter.btrfs
> index ea76e7291108..a1c3013ecb5d 100644
> --- a/common/filter.btrfs
> +++ b/common/filter.btrfs
> @@ -147,5 +147,14 @@ _filter_balance_convert()
>   	_filter_scratch | \
>   	sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g"
>   }
> +
> +# filter output of "btrfs device add"
> +_filter_device_add()
> +{
> +	_filter_scratch | _filter_scratch_pool | \
> +	sed -e "s/Resetting device zones SCRATCH_DEV ([0-9]\+/Resetting device zones SCRATCH_DEV (XXX/g"
> +
> +}
> +
>   # make sure this script returns success
>   /bin/true
> 

Works well with all zone devices.

When only the first device is a zone and the rest aren't,
you are seeing.

-----------
btrfs/310 1s ... - output mismatch (see /fstests/results//btrfs/310.out.bad)
     --- tests/btrfs/310.out	2024-02-26 19:17:51.092325188 +0800
     +++ /fstests/results//btrfs/310.out.bad	2024-02-27 
01:07:13.097603491 +0800
     @@ -2,11 +2,8 @@
      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
     -Resetting device zones SCRATCH_DEV (XXX zones) ...
      ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
      ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
     -Resetting device zones SCRATCH_DEV (XXX zones) ...
     ...
     (Run 'diff -u /fstests/tests/btrfs/310.out 
/fstests/results//btrfs/310.out.bad'  to see the entire diff)

HINT: You _MAY_ be missing kernel fix:
       XXXXXXXXXX btrfs: zoned: don't skip block group profile checks on 
conv zones
-------------

I have the kernel with fixes.

Thanks.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add
  2024-02-26 17:16   ` Anand Jain
@ 2024-02-27 11:18     ` Johannes Thumshirn
  2024-02-27 12:01       ` Anand Jain
  0 siblings, 1 reply; 13+ messages in thread
From: Johannes Thumshirn @ 2024-02-27 11:18 UTC (permalink / raw)
  To: Anand Jain
  Cc: Zorro Lang, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org,
	fdmanana@suse.com

On 26.02.24 18:16, Anand Jain wrote:
> On 2/15/24 17:17, Johannes Thumshirn wrote:
>> Add a filter for the output of btrfs device add.
>>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>> ---
>>    common/filter.btrfs | 9 +++++++++
>>    1 file changed, 9 insertions(+)
>>
>> diff --git a/common/filter.btrfs b/common/filter.btrfs
>> index ea76e7291108..a1c3013ecb5d 100644
>> --- a/common/filter.btrfs
>> +++ b/common/filter.btrfs
>> @@ -147,5 +147,14 @@ _filter_balance_convert()
>>    	_filter_scratch | \
>>    	sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g"
>>    }
>> +
>> +# filter output of "btrfs device add"
>> +_filter_device_add()
>> +{
>> +	_filter_scratch | _filter_scratch_pool | \
>> +	sed -e "s/Resetting device zones SCRATCH_DEV ([0-9]\+/Resetting device zones SCRATCH_DEV (XXX/g"
>> +
>> +}
>> +
>>    # make sure this script returns success
>>    /bin/true
>>
> 
> Works well with all zone devices.
> 
> When only the first device is a zone and the rest aren't,
> you are seeing.
> 
> -----------
> btrfs/310 1s ... - output mismatch (see /fstests/results//btrfs/310.out.bad)
>       --- tests/btrfs/310.out	2024-02-26 19:17:51.092325188 +0800
>       +++ /fstests/results//btrfs/310.out.bad	2024-02-27
> 01:07:13.097603491 +0800
>       @@ -2,11 +2,8 @@
>        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
>       -Resetting device zones SCRATCH_DEV (XXX zones) ...
>        ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
>        ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
>       -Resetting device zones SCRATCH_DEV (XXX zones) ...
>       ...
>       (Run 'diff -u /fstests/tests/btrfs/310.out
> /fstests/results//btrfs/310.out.bad'  to see the entire diff)
> 
> HINT: You _MAY_ be missing kernel fix:
>         XXXXXXXXXX btrfs: zoned: don't skip block group profile checks on
> conv zones
> -------------
> 
> I have the kernel with fixes.
> 

Ah ok, do you want me to update the whole series or send a follow up to 
fold in?

Both is fine for me.



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add
  2024-02-27 11:18     ` Johannes Thumshirn
@ 2024-02-27 12:01       ` Anand Jain
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Jain @ 2024-02-27 12:01 UTC (permalink / raw)
  To: Johannes Thumshirn
  Cc: Zorro Lang, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org,
	fdmanana@suse.com



On 2/27/24 16:48, Johannes Thumshirn wrote:
> On 26.02.24 18:16, Anand Jain wrote:
>> On 2/15/24 17:17, Johannes Thumshirn wrote:
>>> Add a filter for the output of btrfs device add.
>>>
>>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>>> ---
>>>     common/filter.btrfs | 9 +++++++++
>>>     1 file changed, 9 insertions(+)
>>>
>>> diff --git a/common/filter.btrfs b/common/filter.btrfs
>>> index ea76e7291108..a1c3013ecb5d 100644
>>> --- a/common/filter.btrfs
>>> +++ b/common/filter.btrfs
>>> @@ -147,5 +147,14 @@ _filter_balance_convert()
>>>     	_filter_scratch | \
>>>     	sed -e "s/relocate [0-9]\+ out of [0-9]\+ chunks/relocate X out of X chunks/g"
>>>     }
>>> +
>>> +# filter output of "btrfs device add"
>>> +_filter_device_add()
>>> +{
>>> +	_filter_scratch | _filter_scratch_pool | \
>>> +	sed -e "s/Resetting device zones SCRATCH_DEV ([0-9]\+/Resetting device zones SCRATCH_DEV (XXX/g"
>>> +
>>> +}
>>> +
>>>     # make sure this script returns success
>>>     /bin/true
>>>
>>
>> Works well with all zone devices.
>>
>> When only the first device is a zone and the rest aren't,
>> you are seeing.
>>
>> -----------
>> btrfs/310 1s ... - output mismatch (see /fstests/results//btrfs/310.out.bad)
>>        --- tests/btrfs/310.out	2024-02-26 19:17:51.092325188 +0800
>>        +++ /fstests/results//btrfs/310.out.bad	2024-02-27
>> 01:07:13.097603491 +0800
>>        @@ -2,11 +2,8 @@
>>         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
>>        -Resetting device zones SCRATCH_DEV (XXX zones) ...
>>         ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
>>         ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
>>        -Resetting device zones SCRATCH_DEV (XXX zones) ...
>>        ...
>>        (Run 'diff -u /fstests/tests/btrfs/310.out
>> /fstests/results//btrfs/310.out.bad'  to see the entire diff)
>>
>> HINT: You _MAY_ be missing kernel fix:
>>          XXXXXXXXXX btrfs: zoned: don't skip block group profile checks on
>> conv zones
>> -------------
>>
>> I have the kernel with fixes.
>>
> 
> Ah ok, do you want me to update the whole series or send a follow up to
> fold in?
> 

  Just the fix-up patch for 2/3 is fine.

Thanks, Anand

> Both is fine for me.
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems
  2024-02-15 11:47 ` [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems Johannes Thumshirn
@ 2024-02-27 13:12   ` Zorro Lang
  2024-02-27 17:34     ` Johannes Thumshirn
  0 siblings, 1 reply; 13+ messages in thread
From: Zorro Lang @ 2024-02-27 13:12 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Anand Jain, linux-btrfs, fstests, fdmanana

On Thu, Feb 15, 2024 at 03:47:06AM -0800, Johannes Thumshirn wrote:
> 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>
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/310.out | 12 ++++++++++
>  2 files changed, 79 insertions(+)
> 
> diff --git a/tests/btrfs/310 b/tests/btrfs/310
> new file mode 100755
> index 000000000000..c39f60168f8a
> --- /dev/null
> +++ b/tests/btrfs/310
> @@ -0,0 +1,67 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2024 Western Digital Corporation.  All Rights Reserved.
> +#
> +# FS QA Test 310
> +#
> +# Test that btrfs convert can ony be run to convert to supported profiles on a
> +# zoned filesystem
> +#
> +. ./common/preamble
> +_begin_fstest volume raid convert

Don't you want to add it in "auto" group, to be a default test?

> +
> +_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"

OK, looks like don't need to check each devices of SCRATCH_DEV_POOL at here :)

> +
> +devs=( $SCRATCH_DEV_POOL )
> +
> +# Create and mount single device FS
> +_scratch_mkfs -msingle -dsingle 2>&1 > /dev/null

Mkfs with specific options might fail, so better to _fail if mkfs return non-zero,
and better to output the message into .full file, to know what's wrong.

Thanks,
Zorro

> +_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/310.out b/tests/btrfs/310.out
> new file mode 100644
> index 000000000000..bc06b29ecf10
> --- /dev/null
> +++ b/tests/btrfs/310.out
> @@ -0,0 +1,12 @@
> +QA output created by 310
> +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
> +Resetting device zones SCRATCH_DEV (XXX zones) ...
> +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
> +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
> +Resetting device zones SCRATCH_DEV (XXX zones) ...
> +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
> +Resetting device zones SCRATCH_DEV (XXX zones) ...
> +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
> +ERROR: error during balancing 'SCRATCH_MNT': Invalid argument
> 
> -- 
> 2.43.0
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug
  2024-02-15 11:47 [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
                   ` (3 preceding siblings ...)
  2024-02-26 11:53 ` [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
@ 2024-02-27 13:14 ` Zorro Lang
  4 siblings, 0 replies; 13+ messages in thread
From: Zorro Lang @ 2024-02-27 13:14 UTC (permalink / raw)
  To: Johannes Thumshirn; +Cc: Anand Jain, linux-btrfs, fstests, fdmanana

On Thu, Feb 15, 2024 at 03:47:03AM -0800, Johannes Thumshirn wrote:
> Recently we had a report, that a zoned filesystem can be converted to a
> RAID although the RAID stripe tree feature was not enabled.
> 
> Add a regression test for the fix commit.
> 
> ---
> Johannes Thumshirn (3):
>       filter.brtfs: add filter for conversion
>       filter.btrfs: add filter for btrfs device add

Actually these two filters are added for the 3rd patch, so these 3 patches
can be in one patch, don't need one patch one helper. Anyway 3 patches are
good to me too, if you prefer that.

Thanks,
Zorro

>       fstests: btrfs: check conversion of zoned fileystems
> 
>  common/filter.btrfs | 15 ++++++++++++
>  tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  tests/btrfs/310.out | 12 ++++++++++
>  3 files changed, 94 insertions(+)
> ---
> base-commit: 5d761594fc5832d6d940f113b811157e332e14af
> change-id: 20240215-balance-fix-6bd7998efad0
> 
> Best regards,
> -- 
> Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems
  2024-02-27 13:12   ` Zorro Lang
@ 2024-02-27 17:34     ` Johannes Thumshirn
  2024-02-28  9:52       ` Anand Jain
  0 siblings, 1 reply; 13+ messages in thread
From: Johannes Thumshirn @ 2024-02-27 17:34 UTC (permalink / raw)
  To: Zorro Lang
  Cc: Anand Jain, linux-btrfs@vger.kernel.org, fstests@vger.kernel.org,
	fdmanana@suse.com

On 27.02.24 14:12, Zorro Lang wrote:
> On Thu, Feb 15, 2024 at 03:47:06AM -0800, Johannes Thumshirn wrote:
>> 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>
>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>> ---
>>   tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>   tests/btrfs/310.out | 12 ++++++++++
>>   2 files changed, 79 insertions(+)
>>
>> diff --git a/tests/btrfs/310 b/tests/btrfs/310
>> new file mode 100755
>> index 000000000000..c39f60168f8a
>> --- /dev/null
>> +++ b/tests/btrfs/310
>> @@ -0,0 +1,67 @@
>> +#! /bin/bash
>> +# SPDX-License-Identifier: GPL-2.0
>> +# Copyright (c) 2024 Western Digital Corporation.  All Rights Reserved.
>> +#
>> +# FS QA Test 310
>> +#
>> +# Test that btrfs convert can ony be run to convert to supported profiles on a
>> +# zoned filesystem
>> +#
>> +. ./common/preamble
>> +_begin_fstest volume raid convert
> 
> Don't you want to add it in "auto" group, to be a default test?

Actually I do and forgot about it, sorry.


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems
  2024-02-27 17:34     ` Johannes Thumshirn
@ 2024-02-28  9:52       ` Anand Jain
  0 siblings, 0 replies; 13+ messages in thread
From: Anand Jain @ 2024-02-28  9:52 UTC (permalink / raw)
  To: Johannes Thumshirn, Zorro Lang
  Cc: linux-btrfs@vger.kernel.org, fstests@vger.kernel.org,
	fdmanana@suse.com

On 2/27/24 23:04, Johannes Thumshirn wrote:
> On 27.02.24 14:12, Zorro Lang wrote:
>> On Thu, Feb 15, 2024 at 03:47:06AM -0800, Johannes Thumshirn wrote:
>>> 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>
>>> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>>> ---
>>>    tests/btrfs/310     | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>>>    tests/btrfs/310.out | 12 ++++++++++
>>>    2 files changed, 79 insertions(+)
>>>
>>> diff --git a/tests/btrfs/310 b/tests/btrfs/310
>>> new file mode 100755
>>> index 000000000000..c39f60168f8a
>>> --- /dev/null
>>> +++ b/tests/btrfs/310
>>> @@ -0,0 +1,67 @@
>>> +#! /bin/bash
>>> +# SPDX-License-Identifier: GPL-2.0
>>> +# Copyright (c) 2024 Western Digital Corporation.  All Rights Reserved.
>>> +#
>>> +# FS QA Test 310
>>> +#
>>> +# Test that btrfs convert can ony be run to convert to supported profiles on a
>>> +# zoned filesystem
>>> +#
>>> +. ./common/preamble
>>> +_begin_fstest volume raid convert
>>
>> Don't you want to add it in "auto" group, to be a default test?
> 
> Actually I do and forgot about it, sorry.
> 

I missed it too. I'll add it before the PR. I've updated the
mkfs as Zorro suggests.


----------
<snap>

+_begin_fstest auto volume raid convert

<snap>

+_scratch_mkfs -msingle -dsingle 2>&1 >> $seqres.full || _fail "mkfs failed"

<snap>
----------

Thanks, Anand



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2024-02-28  9:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-15 11:47 [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
2024-02-15 11:47 ` [PATCH v3 1/3] filter.brtfs: add filter for conversion Johannes Thumshirn
2024-02-15 11:47 ` [PATCH v3 2/3] filter.btrfs: add filter for btrfs device add Johannes Thumshirn
2024-02-26 17:16   ` Anand Jain
2024-02-27 11:18     ` Johannes Thumshirn
2024-02-27 12:01       ` Anand Jain
2024-02-15 11:47 ` [PATCH v3 3/3] fstests: btrfs: check conversion of zoned fileystems Johannes Thumshirn
2024-02-27 13:12   ` Zorro Lang
2024-02-27 17:34     ` Johannes Thumshirn
2024-02-28  9:52       ` Anand Jain
2024-02-26 11:53 ` [PATCH v3 0/3] fstests: btrfs: add test for zoned balance profile conversion bug Johannes Thumshirn
2024-02-26 12:52   ` Anand Jain
2024-02-27 13:14 ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox