Skip to contentSkip to conversation

fstests: btrfs pending misc fixes

PATCH In review Anand Jain 2 participants 6 messages Mar 14, 2024 Btrfs file system

lore
Share & tools
lore

Anand Jain

author
#0 lore raw

v2 cover fstests: btrfs pending misc fixes

v2:
Patches 1/4 and 2/4 are new, not found in v1. Patches 3/4 and 4/4 were sent before and now use a helper in 1/4, thus v2 and bundled together.

Adds _require_btrfs_send_version and uses it in the patchset that came from Boris. Also, sending out patch 2/4 for Boris which isn't found in the ML, but picked up from the btrfs fstests repo.

These are in the queue for next pr.

Anand Jain (1):
common/btrfs: introduce _require_btrfs_send_version

Boris Burkov (3):
btrfs/320: skip -O squota runs
btrfs/277: specify protocol version 3 for verity send btrfs/316: use rescan wrapper

 common/btrfs    | 10 ++++++----
 tests/btrfs/277 |  3 ++-
 tests/btrfs/281 |  2 +-
 tests/btrfs/284 |  2 +-
 tests/btrfs/316 |  3 ++-
 tests/btrfs/320 |  6 ++++--
 6 files changed, 16 insertions(+), 10 deletions(-)
Signature · 1 line
2.39.3
author
#1 lore raw

PATCH v2 1/4 common/btrfs: introduce _require_btrfs_send_version

Rename _require_btrfs_send_v2() to _require_btrfs_send_version() and check if the Btrfs kernel supports the v3 stream.

---
 common/btrfs    | 10 ++++++----
 tests/btrfs/281 |  2 +-
 tests/btrfs/284 |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)
common/btrfs +6 -4
index aa344706cd5f..ae13fb55cbc6 100644
@@ -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.
tests/btrfs/281 +1 -1
index 6407522567b8..ddc7d9e8b06d 100755
@@ -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
tests/btrfs/284 +1 -1
index c6692668f7fc..0df494bc8ab4 100755
@@ -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
Signature · 1 line
2.39.3
Reviewed-by on v2 1/4
#2 lore raw

Re: [PATCH v2 1/4] common/btrfs: introduce _require_btrfs_send_version

Quoted 4 lines · Anand Jain

Rename _require_btrfs_send_v2() to _require_btrfs_send_version() and check if the Btrfs kernel supports the v3 stream.

Quoted 64 lines
---
 common/btrfs    | 10 ++++++----
 tests/btrfs/281 |  2 +-
 tests/btrfs/284 |  2 +-
 3 files changed, 8 insertions(+), 6 deletions(-)
common/btrfs +6 -4
index aa344706cd5f..ae13fb55cbc6 100644
@@ -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.
tests/btrfs/281 +1 -1
index 6407522567b8..ddc7d9e8b06d 100755
@@ -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
tests/btrfs/284 +1 -1
index c6692668f7fc..0df494bc8ab4 100755
@@ -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
Signature · 1 line
2.39.3
author
#3 lore raw

PATCH v2 2/4 btrfs/320: skip -O squota runs

In reply to Anand Jain

From: Boris Burkov <[email protected]>

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.

[ added _require_qgroup_rescan ]
---
 tests/btrfs/320 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
tests/btrfs/320 +4 -2
index 408053457aba..df7acdbb3deb 100755
@@ -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 }') ] || \
Signature · 1 line
2.39.3
author
#4 lore raw

PATCH v2 3/4 btrfs/277: specify protocol version 3 for verity send

In reply to Anand Jain

From: Boris Burkov <[email protected]>

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.

[ added _require_btrfs_send_version 3 ]
---
 tests/btrfs/277 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/btrfs/277 +2 -1
index f5684fde1b90..5bb7ffabdd2f 100755
@@ -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
Signature · 1 line
2.39.3
author
#5 lore raw

PATCH v2 4/4 btrfs/316: use rescan wrapper

In reply to Anand Jain

From: Boris Burkov <[email protected]>

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.

---
 tests/btrfs/316 | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tests/btrfs/316 +2 -1
index 07a94334a9ef..5ef3ebe9f9e7 100755
@@ -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
Signature · 1 line
2.39.3