* [PATCH v2 1/4] common/btrfs: introduce _require_btrfs_send_version
2024-03-14 10:37 [PATCH v2 0/4] fstests: btrfs pending misc fixes Anand Jain
@ 2024-03-14 10:37 ` Anand Jain
2024-03-14 16:40 ` Boris Burkov
2024-03-14 10:37 ` [PATCH v2 2/4] btrfs/320: skip -O squota runs Anand Jain
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Anand Jain @ 2024-03-14 10:37 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, boris
Rename _require_btrfs_send_v2() to _require_btrfs_send_version() and
check if the Btrfs kernel supports the v3 stream.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
common/btrfs | 10 ++++++----
tests/btrfs/281 | 2 +-
tests/btrfs/284 | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/common/btrfs b/common/btrfs
index aa344706cd5f..ae13fb55cbc6 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -662,18 +662,20 @@ _require_btrfs_corrupt_block()
_require_command "$BTRFS_CORRUPT_BLOCK_PROG" btrfs-corrupt-block
}
-_require_btrfs_send_v2()
+_require_btrfs_send_version()
{
+ local version=$1
+
# Check first if btrfs-progs supports the v2 stream.
_require_btrfs_command send --compressed-data
# Now check the kernel support. If send_stream_version does not exists,
# then it's a kernel that only supports v1.
[ -f /sys/fs/btrfs/features/send_stream_version ] || \
- _notrun "kernel does not support send stream v2"
+ _notrun "kernel does not support send stream $version"
- [ $(cat /sys/fs/btrfs/features/send_stream_version) -gt 1 ] || \
- _notrun "kernel does not support send stream v2"
+ [ $(cat /sys/fs/btrfs/features/send_stream_version) -ge $version ] || \
+ _notrun "kernel does not support send stream $version"
}
# Get the bytenr associated to a file extent item at a given file offset.
diff --git a/tests/btrfs/281 b/tests/btrfs/281
index 6407522567b8..ddc7d9e8b06d 100755
--- a/tests/btrfs/281
+++ b/tests/btrfs/281
@@ -22,7 +22,7 @@ _begin_fstest auto quick send compress clone fiemap
_supported_fs btrfs
_require_test
_require_scratch_reflink
-_require_btrfs_send_v2
+_require_btrfs_send_version 2
_require_xfs_io_command "fiemap"
_require_fssum
_require_btrfs_no_nodatacow
diff --git a/tests/btrfs/284 b/tests/btrfs/284
index c6692668f7fc..0df494bc8ab4 100755
--- a/tests/btrfs/284
+++ b/tests/btrfs/284
@@ -12,7 +12,7 @@ _begin_fstest auto quick send compress snapshot
# Modify as appropriate.
_supported_fs btrfs
-_require_btrfs_send_v2
+_require_btrfs_send_version 2
_require_test
# The size needed is variable as it depends on the specific randomized
# operations from fsstress and on the value of $LOAD_FACTOR. But require at
--
2.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH v2 1/4] common/btrfs: introduce _require_btrfs_send_version
2024-03-14 10:37 ` [PATCH v2 1/4] common/btrfs: introduce _require_btrfs_send_version Anand Jain
@ 2024-03-14 16:40 ` Boris Burkov
0 siblings, 0 replies; 6+ messages in thread
From: Boris Burkov @ 2024-03-14 16:40 UTC (permalink / raw)
To: Anand Jain; +Cc: fstests, linux-btrfs
On Thu, Mar 14, 2024 at 04:07:37PM +0530, Anand Jain wrote:
> Rename _require_btrfs_send_v2() to _require_btrfs_send_version() and
> check if the Btrfs kernel supports the v3 stream.
>
> Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Boris Burkov <boris@bur.io>
> ---
> common/btrfs | 10 ++++++----
> tests/btrfs/281 | 2 +-
> tests/btrfs/284 | 2 +-
> 3 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/common/btrfs b/common/btrfs
> index aa344706cd5f..ae13fb55cbc6 100644
> --- a/common/btrfs
> +++ b/common/btrfs
> @@ -662,18 +662,20 @@ _require_btrfs_corrupt_block()
> _require_command "$BTRFS_CORRUPT_BLOCK_PROG" btrfs-corrupt-block
> }
>
> -_require_btrfs_send_v2()
> +_require_btrfs_send_version()
> {
> + local version=$1
> +
> # Check first if btrfs-progs supports the v2 stream.
> _require_btrfs_command send --compressed-data
>
> # Now check the kernel support. If send_stream_version does not exists,
> # then it's a kernel that only supports v1.
> [ -f /sys/fs/btrfs/features/send_stream_version ] || \
> - _notrun "kernel does not support send stream v2"
> + _notrun "kernel does not support send stream $version"
>
> - [ $(cat /sys/fs/btrfs/features/send_stream_version) -gt 1 ] || \
> - _notrun "kernel does not support send stream v2"
> + [ $(cat /sys/fs/btrfs/features/send_stream_version) -ge $version ] || \
> + _notrun "kernel does not support send stream $version"
> }
>
> # Get the bytenr associated to a file extent item at a given file offset.
> diff --git a/tests/btrfs/281 b/tests/btrfs/281
> index 6407522567b8..ddc7d9e8b06d 100755
> --- a/tests/btrfs/281
> +++ b/tests/btrfs/281
> @@ -22,7 +22,7 @@ _begin_fstest auto quick send compress clone fiemap
> _supported_fs btrfs
> _require_test
> _require_scratch_reflink
> -_require_btrfs_send_v2
> +_require_btrfs_send_version 2
> _require_xfs_io_command "fiemap"
> _require_fssum
> _require_btrfs_no_nodatacow
> diff --git a/tests/btrfs/284 b/tests/btrfs/284
> index c6692668f7fc..0df494bc8ab4 100755
> --- a/tests/btrfs/284
> +++ b/tests/btrfs/284
> @@ -12,7 +12,7 @@ _begin_fstest auto quick send compress snapshot
>
> # Modify as appropriate.
> _supported_fs btrfs
> -_require_btrfs_send_v2
> +_require_btrfs_send_version 2
> _require_test
> # The size needed is variable as it depends on the specific randomized
> # operations from fsstress and on the value of $LOAD_FACTOR. But require at
> --
> 2.39.3
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2 2/4] btrfs/320: skip -O squota runs
2024-03-14 10:37 [PATCH v2 0/4] fstests: btrfs pending misc fixes Anand Jain
2024-03-14 10:37 ` [PATCH v2 1/4] common/btrfs: introduce _require_btrfs_send_version Anand Jain
@ 2024-03-14 10:37 ` Anand Jain
2024-03-14 10:37 ` [PATCH v2 3/4] btrfs/277: specify protocol version 3 for verity send Anand Jain
2024-03-14 10:37 ` [PATCH v2 4/4] btrfs/316: use rescan wrapper Anand Jain
3 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2024-03-14 10:37 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, boris
From: Boris Burkov <boris@bur.io>
This test makes assumptions about the shared usage under snapshots which
are not valid when using squotas. Skip squotas for this test.
Also, make it use the rescan wrapper, just for uniformity and since it
doesn't hurt.
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ added _require_qgroup_rescan ]
---
tests/btrfs/320 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tests/btrfs/320 b/tests/btrfs/320
index 408053457aba..df7acdbb3deb 100755
--- a/tests/btrfs/320
+++ b/tests/btrfs/320
@@ -15,7 +15,9 @@ _begin_fstest auto qgroup limit
_supported_fs btrfs
_require_scratch
+_require_qgroup_rescan
_require_btrfs_qgroup_report
+_require_scratch_qgroup
# Test to make sure we can actually turn it on and it makes sense
_basic_test()
@@ -23,7 +25,7 @@ _basic_test()
echo "=== basic test ===" >> $seqres.full
_run_btrfs_util_prog subvolume create $SCRATCH_MNT/a
_run_btrfs_util_prog quota enable $SCRATCH_MNT/a
- _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+ _qgroup_rescan $SCRATCH_MNT
subvolid=$(_btrfs_get_subvolid $SCRATCH_MNT a)
$BTRFS_UTIL_PROG qgroup show $units $SCRATCH_MNT | grep $subvolid >> \
$seqres.full 2>&1
@@ -62,7 +64,7 @@ _rescan_test()
echo "qgroup values before rescan: $output" >> $seqres.full
refer=$(echo $output | $AWK_PROG '{ print $2 }')
excl=$(echo $output | $AWK_PROG '{ print $3 }')
- _run_btrfs_util_prog quota rescan -w $SCRATCH_MNT
+ _qgroup_rescan $SCRATCH_MNT
output=$($BTRFS_UTIL_PROG qgroup show $units $SCRATCH_MNT | grep "0/$subvolid")
echo "qgroup values after rescan: $output" >> $seqres.full
[ $refer -eq $(echo $output | $AWK_PROG '{ print $2 }') ] || \
--
2.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 3/4] btrfs/277: specify protocol version 3 for verity send
2024-03-14 10:37 [PATCH v2 0/4] fstests: btrfs pending misc fixes Anand Jain
2024-03-14 10:37 ` [PATCH v2 1/4] common/btrfs: introduce _require_btrfs_send_version Anand Jain
2024-03-14 10:37 ` [PATCH v2 2/4] btrfs/320: skip -O squota runs Anand Jain
@ 2024-03-14 10:37 ` Anand Jain
2024-03-14 10:37 ` [PATCH v2 4/4] btrfs/316: use rescan wrapper Anand Jain
3 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2024-03-14 10:37 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, boris
From: Boris Burkov <boris@bur.io>
This test uses btrfs send with fs-verity which relies on protocol
version 3. The default in progs is version 2, so we need to explicitly
specify the protocol version. Note that the max protocol version in
progs is also currently broken (not properly gated by EXPERIMENTAL) so
that needs fixing as well.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
[ added _require_btrfs_send_version 3 ]
---
tests/btrfs/277 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/btrfs/277 b/tests/btrfs/277
index f5684fde1b90..5bb7ffabdd2f 100755
--- a/tests/btrfs/277
+++ b/tests/btrfs/277
@@ -29,6 +29,7 @@ _require_scratch_verity
_require_fsverity_builtin_signatures
_require_command "$SETCAP_PROG" setcap
_require_command "$GETCAP_PROG" getcap
+_require_btrfs_send_version 3
subv=$SCRATCH_MNT/subv
fsv_file=$subv/file.fsv
@@ -84,7 +85,7 @@ _test_send_verity() {
echo "set subvolume read only"
$BTRFS_UTIL_PROG property set $subv ro true
echo "send subvolume"
- $BTRFS_UTIL_PROG send $subv -f $stream -q >> $seqres.full
+ $BTRFS_UTIL_PROG send $subv -f $stream -q --proto=3 >> $seqres.full
echo "blow away fs"
_scratch_unmount
--
2.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH v2 4/4] btrfs/316: use rescan wrapper
2024-03-14 10:37 [PATCH v2 0/4] fstests: btrfs pending misc fixes Anand Jain
` (2 preceding siblings ...)
2024-03-14 10:37 ` [PATCH v2 3/4] btrfs/277: specify protocol version 3 for verity send Anand Jain
@ 2024-03-14 10:37 ` Anand Jain
3 siblings, 0 replies; 6+ messages in thread
From: Anand Jain @ 2024-03-14 10:37 UTC (permalink / raw)
To: fstests; +Cc: linux-btrfs, boris
From: Boris Burkov <boris@bur.io>
btrfs/316 is broken on the squota configuration because it uses a raw
rescan call which fails, instead of using the rescan wrapper. The test
passes with squota, so run it (instead of requiring rescan) though I
suspect it isn't the most meaningful test.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Boris Burkov <boris@bur.io>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
---
tests/btrfs/316 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/btrfs/316 b/tests/btrfs/316
index 07a94334a9ef..5ef3ebe9f9e7 100755
--- a/tests/btrfs/316
+++ b/tests/btrfs/316
@@ -16,6 +16,7 @@ _begin_fstest auto quick qgroup
_supported_fs btrfs
_require_scratch
+_require_qgroup_rescan
_fixed_by_kernel_commit xxxxxxxxxxxx \
"btrfs: qgroup: always free reserved space for extent records"
@@ -24,7 +25,7 @@ _scratch_mkfs >> $seqres.full
_scratch_mount
$BTRFS_UTIL_PROG quota enable $SCRATCH_MNT
-$BTRFS_UTIL_PROG quota rescan -w $SCRATCH_MNT >> $seqres.full
+_qgroup_rescan $SCRATCH_MNT >> $seqres.full
$BTRFS_UTIL_PROG qgroup create 1/0 $SCRATCH_MNT >> $seqres.full
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subv1 >> $seqres.full
--
2.39.3
^ permalink raw reply related [flat|nested] 6+ messages in thread