Skip to contentSkip to conversation

ext4/048: Add new regression test

PATCH Superseded chenlong 1 participant 1 message May 20, 2021

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

chenlong

author
#0 lore raw

PATCH v2 1/1 ext4/048: Add new regression test

Check the block group zero and prevent initializing reserved inodes. But in some special cases, the reserved inode may not all belong to the group zero, it may exist into the second group if we format filesystem below.
mkfs.ext4 -b 4096 -g 8192 -N 1024 -I 4096 /dev/sda
So, it will end up triggering a false positive report of a corrupted file system

It's a regression test for commit a149d2a5cabb.

---
 tests/ext4/048     | 50 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/048.out |  5 +++++
 tests/ext4/group   |  1 +
 3 files changed, 56 insertions(+)
 create mode 100755 tests/ext4/048
 create mode 100644 tests/ext4/048.out
tests/ext4/048 new file +50 -0
new file mode 100755
index 00000000..36ee0884
@@ -0,0 +1,50 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021 Huawei.  All Rights Reserved.
+#
+# FS QA Test 048
+#
+# Regression test for commit:
+# a149d2a5cabb(ext4: fix check to prevent false positive report of incorrect
+# used inodes)
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1	# failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+    cd /
+    rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs ext4
+_require_scratch
+
+echo "+ create scratch fs"
+_scratch_mkfs_ext4 -b 4096 -g 8192 -N 1024 -I 4096 >> $seqres.full 2>&1
+
+echo "+ mount fs"
+_scratch_mount -o errors=remount-ro
+sleep 5
+
+echo "+ check mountpoint status"
+cat /proc/self/mounts | grep -w ${SCRATCH_MNT} | \
+    $AWK_PROG '{print $4}' | grep -oE '^rw,' | tee -a $seqres.full
+
+# success, all done
+status=0
+exit
tests/ext4/048.out new file +5 -0
new file mode 100644
index 00000000..16e50e86
@@ -0,0 +1,5 @@
+QA output created by 048
++ create scratch fs
++ mount fs
++ check mountpoint status
+rw,
tests/ext4/group +1 -0
index ceda2ba6..82b77efb 100644
@@ -50,6 +50,7 @@
 045 auto dir
 046 auto prealloc quick
 047 auto quick dax
+048 auto quick
 271 auto rw quick
 301 aio auto ioctl rw stress defrag
 302 aio auto ioctl rw stress defrag
Signature · 1 line
2.18.0.huawei.25