xfs/49[12]: skip pre-lazysbcount filesystems
authorDarrick J. Wong <djwong@kernel.org>
Thu, 29 Apr 2021 01:31:54 +0000 (18:31 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 9 May 2021 15:27:50 +0000 (23:27 +0800)
Prior to lazysbcount, the xfs mount code blindly trusted the value of
the fdblocks counter in the primary super, which means that the kernel
doesn't detect the fuzzed fdblocks value at all.  V4 is deprecated and
pre-lazysbcount V4 hasn't been the default for ~14 years, so we'll just
skip these two tests on those old filesystems.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
common/xfs
tests/xfs/491
tests/xfs/492

index ce49057c686d8287ffaf1607ecfda08bacaa83e1..5cd7b35c9ec9a468c9ee31294bb0f69cd8849b61 100644 (file)
@@ -1144,6 +1144,18 @@ _check_scratch_xfs_features()
        test "${found}" -eq "$#"
 }
 
        test "${found}" -eq "$#"
 }
 
+# Skip a test if any of the given fs features aren't present on the scratch
+# filesystem.  The scratch fs must have been formatted already.
+_require_scratch_xfs_features()
+{
+       local features="$(_scratch_xfs_db -c 'version' 2>/dev/null)"
+
+       for feature in "$@"; do
+               echo "${features}" | grep -q -w "${feature}" ||
+                       _notrun "Missing scratch feature: ${feature}"
+       done
+}
+
 # Decide if xfs_repair knows how to set (or clear) a filesystem feature.
 _require_xfs_repair_upgrade()
 {
 # Decide if xfs_repair knows how to set (or clear) a filesystem feature.
 _require_xfs_repair_upgrade()
 {
index 6420202ba88b0fd8a3d33a76d138b8bf0bc200bc..7d447ccf467e990c90c121253f992149668c8a2c 100755 (executable)
@@ -36,6 +36,10 @@ _require_scratch
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
+
+# pre-lazysbcount filesystems blindly trust the primary sb fdblocks
+_require_scratch_xfs_features LAZYSBCOUNT
+
 _scratch_mount >> $seqres.full 2>&1
 echo "test file" > $SCRATCH_MNT/testfile
 
 _scratch_mount >> $seqres.full 2>&1
 echo "test file" > $SCRATCH_MNT/testfile
 
index 522def478d13cbd96be22fcbb523b4124cebce92..21c6872fe14ec87ca26725a666dfd7c40ae27664 100755 (executable)
@@ -36,6 +36,10 @@ _require_scratch
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
 
 echo "Format and mount"
 _scratch_mkfs > $seqres.full 2>&1
+
+# pre-lazysbcount filesystems blindly trust the primary sb fdblocks
+_require_scratch_xfs_features LAZYSBCOUNT
+
 _scratch_mount >> $seqres.full 2>&1
 echo "test file" > $SCRATCH_MNT/testfile
 
 _scratch_mount >> $seqres.full 2>&1
 echo "test file" > $SCRATCH_MNT/testfile