From: Anand Suveer Jain <asj@kernel.org>
To: Qu Wenruo <wqu@suse.com>,
fstests@vger.kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] fstests: btrfs: new test case for leaking BTRFS_FS_STATE_REMOUNTING flag
Date: Tue, 7 Jul 2026 17:44:57 +0800 [thread overview]
Message-ID: <8aa304b0-99bb-4940-923a-27abf9bd6b9b@kernel.org> (raw)
In-Reply-To: <20260704085208.86039-1-wqu@suse.com>
On 4/7/26 16:52, Qu Wenruo wrote:
> This is a regression test for the patch "btrfs: fix leaking
> BTRFS_FS_STATE_REMOUNTING flag", where conflicting mount options can
> cause btrfs leave BTRFS_FS_STATE_REMOUNTING set.
>
> Such set BTRFS_FS_STATE_REMOUNTING will interrupt several features, and
> the test case will use "btrfs qgroup rescan" to catch the
> BTRFS_FS_STATE_REMOUNTING flag.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> tests/btrfs/352 | 53 +++++++++++++++++++++++++++++++++++++++++++++
> tests/btrfs/352.out | 2 ++
> 2 files changed, 55 insertions(+)
> create mode 100755 tests/btrfs/352
> create mode 100644 tests/btrfs/352.out
>
> diff --git a/tests/btrfs/352 b/tests/btrfs/352
> new file mode 100755
> index 00000000..2ccf7fab
> --- /dev/null
> +++ b/tests/btrfs/352
> @@ -0,0 +1,53 @@
> +#! /bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (c) 2026 SUSE S.A. All Rights Reserved.
> +#
> +# FS QA Test 352
> +#
> +# A regression test to make sure failed remount won't leave
> +# BTRFS_FS_STATE_REMOUNTING flag set, which can interrupt several features,
> +# one of them is btrfs qgroup rescan.
> +#
> +. ./common/preamble
> +_begin_fstest auto quick remount
> +
> +_fixed_by_kernel_commit XXXXXXXXXXXX \
> + "btrfs: fix leaking BTRFS_FS_STATE_REMOUNTING flag"
> +
We can replace this section with the existing helpers or,
even better, with a new one as shown below. I am not too
particular about creating a new helper, that is up to you.
However, the use of existing helpers such as
_require_btrfs_fs_sysfs and _require_btrfs_fs_feature
will be better. Thanks
> +rescue_opts="/sys/fs/btrfs/features/supported_rescue_options"
> +if [ ! -f "$rescue_opts" ]; then
> + _notrun "No supported_rescue_options sysfs interface"
> +fi
> +
> +if ! grep -q "ignorebadroots" "$rescue_opts"; then
> + _notrun "\"rescue=ignorebadroots\" mount option not supported"
> +fi
> +
diff --git a/common/btrfs b/common/btrfs
index 30288f07b61a..57453fb39893 100644
--- a/common/btrfs
+++ b/common/btrfs
@@ -100,6 +100,29 @@ _require_btrfs_mkfs_uuid_option()
fi
}
+# Check for the availability of a specific option within a btrfs
feature set
+# Arguments:
+# $1 - Feature attribute of /sys/fs/btrfs/features/
+# $2 - Option string to verify inside that file
+_require_btrfs_fs_feature_option()
+{
+ local feat=$1
+ local feat_type=$2
+
+ if [ -z "$feat" ] || [ -z "$feat_type" ]; then
+ echo "Missing argument(s) for _require_btrfs_fs_feature_type"
+ _exit 1
+ fi
+
+ modprobe btrfs > /dev/null 2>&1
+
+ _require_btrfs_fs_feature "$feat"
+
+ if ! grep -qw "$feat_type" "/sys/fs/btrfs/features/$feat"; then
+ _notrun "Feature type '$feat_type' not supported by the available
btrfs version"
+ fi
+}
+
_require_btrfs_fs_feature()
{
if [ -z $1 ]; then
diff --git a/tests/btrfs/352 b/tests/btrfs/352
index 2ccf7fabdb71..14e357dbaa37 100755
--- a/tests/btrfs/352
+++ b/tests/btrfs/352
@@ -14,15 +14,8 @@ _begin_fstest auto quick remount
_fixed_by_kernel_commit XXXXXXXXXXXX \
"btrfs: fix leaking BTRFS_FS_STATE_REMOUNTING flag"
-rescue_opts="/sys/fs/btrfs/features/supported_rescue_options"
-if [ ! -f "$rescue_opts" ]; then
- _notrun "No supported_rescue_options sysfs interface"
-fi
-
-if ! grep -q "ignorebadroots" "$rescue_opts"; then
- _notrun "\"rescue=ignorebadroots\" mount option not supported"
-fi
-
+_require_btrfs_fs_sysfs
+_require_btrfs_fs_feature_option "supported_rescue_options"
"ignorebadroots"
_require_btrfs_command quota rescan -w
_require_scratch
_scratch_mkfs >> $seqres.full
next prev parent reply other threads:[~2026-07-07 9:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 8:52 [PATCH] fstests: btrfs: new test case for leaking BTRFS_FS_STATE_REMOUNTING flag Qu Wenruo
2026-07-07 9:44 ` Anand Suveer Jain [this message]
2026-07-07 9:58 ` Qu Wenruo
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=8aa304b0-99bb-4940-923a-27abf9bd6b9b@kernel.org \
--to=asj@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=wqu@suse.com \
/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