public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: Sun Ke <sunke32@huawei.com>
To: <fstests@vger.kernel.org>
Cc: <zlang@kernel.org>, <linux-ext4@vger.kernel.org>, <sunke32@huawei.com>
Subject: [PATCH v4] ext4: resize fs after set reserved GDT blocks equals 100
Date: Tue, 26 Jul 2022 11:22:40 +0800	[thread overview]
Message-ID: <20220726032240.3709879-1-sunke32@huawei.com> (raw)

Set reserved GDT blocks equals 100, then resize fs, will trigger null
pointer.

Regression test for commit b55c3cd102a6 ext4: add reserved GDT blocks
check.

Signed-off-by: Sun Ke <sunke32@huawei.com>
---
 tests/ext4/057     | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/ext4/057.out |  2 ++
 2 files changed, 48 insertions(+)
 create mode 100755 tests/ext4/057
 create mode 100644 tests/ext4/057.out

diff --git a/tests/ext4/057 b/tests/ext4/057
new file mode 100755
index 00000000..f4bbcd32
--- /dev/null
+++ b/tests/ext4/057
@@ -0,0 +1,46 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2022 HUAWEI.  All Rights Reserved.
+#
+# FS QA Test 057
+#
+# Set reserved GDT blocks equals 100, then resize fs, will trigger null pointer.
+#
+# Regression test for commit
+# b55c3cd102a6 ext4: add reserved GDT blocks check
+#
+. ./common/preamble
+_begin_fstest auto resize quick
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs ext4
+_fixed_by_kernel_commit b55c3cd102a6 \
+	"ext4: add reserved GDT blocks check"
+
+_require_command "$TUNE2FS_PROG" tune2fs
+_require_command "$RESIZE2FS_PROG" resize2fs
+_require_command "$DEBUGFS_PROG" debugfs
+_require_scratch_size $((1024 * 1024)) #kB
+_require_scratch_nocheck
+
+# set fs size 512M
+dev_size=$((512 * 1024 * 1024))
+MKFS_OPTIONS="-O ^resize_inode $MKFS_OPTIONS" _scratch_mkfs_sized $dev_size \
+	>>$seqres.full 2>&1 || _fail "mkfs failed"
+
+$DEBUGFS_PROG -w -R "set_super_value s_reserved_gdt_blocks 100" $SCRATCH_DEV \
+	>>$seqres.full 2>&1
+
+$DEBUGFS_PROG -R "show_super_stats -h" $SCRATCH_DEV 2>/dev/null | \
+	grep "Reserved GDT blocks"
+
+_scratch_mount
+
+# resize fs will trigger NULL pointer in ext4_flex_group_add
+$RESIZE2FS_PROG $SCRATCH_DEV 1G >> $seqres.full 2>&1
+
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/057.out b/tests/ext4/057.out
new file mode 100644
index 00000000..99423e16
--- /dev/null
+++ b/tests/ext4/057.out
@@ -0,0 +1,2 @@
+QA output created by 057
+Reserved GDT blocks:      100
-- 
2.13.6


             reply	other threads:[~2022-07-26  3:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26  3:22 Sun Ke [this message]
2022-07-26  5:04 ` [PATCH v4] ext4: resize fs after set reserved GDT blocks equals 100 Zorro Lang

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=20220726032240.3709879-1-sunke32@huawei.com \
    --to=sunke32@huawei.com \
    --cc=fstests@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=zlang@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox