All of lore.kernel.org
 help / color / mirror / Atom feed
From: chenlong <chenlongcl.chen@huawei.com>
To: <fstests@vger.kernel.org>, <guaneryu@gmail.com>, <tytso@mit.edu>
Cc: <chenlongcl.chen@huawei.com>
Subject: [PATCH v4] ext4/048: Add new regression test
Date: Fri, 28 May 2021 11:13:07 +0800	[thread overview]
Message-ID: <20210528031307.31244-1-chenlongcl.chen@huawei.com> (raw)

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.

Signed-off-by: Chen Long <chenlongcl.chen@huawei.com>
---
 tests/ext4/048     | 68 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/048.out |  7 +++++
 tests/ext4/group   |  1 +
 3 files changed, 76 insertions(+)
 create mode 100755 tests/ext4/048
 create mode 100644 tests/ext4/048.out

diff --git a/tests/ext4/048 b/tests/ext4/048
new file mode 100755
index 00000000..54f9f0e2
--- /dev/null
+++ b/tests/ext4/048
@@ -0,0 +1,68 @@
+#! /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
+
+sdev=$(_short_dev ${SCRATCH_DEV})
+# default sleep interval
+sleep_time=5
+
+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
+# The default maximum wake-up delay of the lazy init thread of ext4 is
+# EXT4_DEF_LI_MAX_START_DELAY (5s).
+# After mounting the file system, the lazy init thread will be awakened to
+# perform group initialization at 0~5s after the current time. If an error
+# is detected during the initialization process, it will be set to read-only,
+# so the test case needs to delay a little while waiting for the init thread
+# to execute.
+sleep $sleep_time
+
+echo "+ check mountpoint status"
+cat /proc/self/mounts | grep -w ${SCRATCH_MNT} | \
+    $AWK_PROG '{print $4}' | grep -oE '^rw,' | tee -a $seqres.full
+
+echo "+ check mountpoint writability"
+test -w $SCRATCH_MNT || echo "scratch mount should still be writable"
+
+echo "+ check dmesg"
+_check_dmesg_for "\(${sdev}\): Remounting filesystem read-only" && \
+    echo "scratch dev should not be remounted to read-only"
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/048.out b/tests/ext4/048.out
new file mode 100644
index 00000000..6f0075e1
--- /dev/null
+++ b/tests/ext4/048.out
@@ -0,0 +1,7 @@
+QA output created by 048
++ create scratch fs
++ mount fs
++ check mountpoint status
+rw,
++ check mountpoint writability
++ check dmesg
diff --git a/tests/ext4/group b/tests/ext4/group
index ceda2ba6..82b77efb 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -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
-- 
2.18.0.huawei.25


                 reply	other threads:[~2021-05-28  3:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210528031307.31244-1-chenlongcl.chen@huawei.com \
    --to=chenlongcl.chen@huawei.com \
    --cc=fstests@vger.kernel.org \
    --cc=guaneryu@gmail.com \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.