]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
btrfs/340: add support for older kernels/progs
authorQu Wenruo <wqu@suse.com>
Thu, 14 May 2026 09:04:39 +0000 (18:34 +0930)
committerZorro Lang <zlang@kernel.org>
Sun, 17 May 2026 08:11:33 +0000 (16:11 +0800)
The test case will fail on older distros like SLE12-SP5, there are two
problems on the test case itself:

- Requires "--sync" option from "btrfs qgroup show" subcommand
  That option was introduecd in v4.9.1, thus there are still some older
  distros using that very old version.

- Not all kernels support quick inherit
  The kernel commit introducing the quick inherit is 6.9, thus some
  supported LTS kernels do not have that commit.

  In that case qgroup will just be marked inconsistent, this will cause
  the later "btrfs qgroup show" command to output a warning due to the
  inconsistent flag.

Fix both problems by:

- Require "--sync" option from "btrfs qgroup show" subcommand
  So older distros will just skip the test.

- Redirect all output from "btrfs qgroup show" to $seqres.full
  So older kernels can still pass the test case by marking qgroup
  inconsitent.

Reported-by: Long An <lan@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Zorro Lang <zlang@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
tests/btrfs/340

index 872f790cb9753093616789a0dba1e2be876a8dc5..eff76d0b633c595a42f5e34c42f993a24a685988 100755 (executable)
@@ -16,6 +16,7 @@ _fixed_by_kernel_commit 68d4b3fa18d7 \
 # For the automatic fsck at unmount.
 _require_scratch
 _require_btrfs_qgroup_report
+_require_btrfs_command qgroup show --sync
 
 # This will imply mkfs and enable regular qgroup.
 _require_scratch_qgroup
@@ -39,7 +40,12 @@ _btrfs qgroup show -p --sync $SCRATCH_MNT >> $seqres.full
 # without marking qgroup inconsistent.
 _btrfs subv snap -i 1/1 $SCRATCH_MNT/subv1 $SCRATCH_MNT/snap1
 echo "After quick inherit:" >> $seqres.full
-_btrfs qgroup show -p --sync $SCRATCH_MNT >> $seqres.full
+# Redirect all output to seqres.full including stderr.
+# For older kernels without quick inherit support, it will mark
+# qgroup inconsistent, which will output a warning about the inconsistent
+# numbers. Here we rely on the final btrfs check to catch any qgroup number
+# errors, thus no need to bother that possible warning.
+_btrfs qgroup show -p --sync $SCRATCH_MNT >> $seqres.full 2>&1
 
 echo "Silence is golden"
 _exit 0