From: Yifan Feng <evanfengff@gmail.com>
To: Andreas Gruenbacher <agruenba@redhat.com>
Cc: Andrew Price <anprice@redhat.com>,
gfs2@lists.linux.dev, linux-kernel@vger.kernel.org,
Yifan Feng <evanfengff@gmail.com>
Subject: [PATCH] gfs2: Fix the inverted barrier mount option
Date: Tue, 1 Dec 2026 16:23:54 -0800 [thread overview]
Message-ID: <20261202002354.72253-1-evanfengff@gmail.com> (raw)
For an option that can be negated, result.boolean is true when the
option is given without "no". So since the conversion to fs_context
"barrier" sets ar_nobarrier and "nobarrier" clears it. A mount with
-o barrier sends no cache flushes to the disk, and -o nobarrier has no
effect:
# mount -o barrier /dev/vda /mnt
# grep /mnt /proc/mounts
/dev/vda /mnt gfs2 rw,relatime,localflocks,nobarrier,rgrplvb 0 0
Use result.negated.
Fixes: 1f52aa08d12f ("gfs2: Convert gfs2 to fs_context")
Signed-off-by: Yifan Feng <evanfengff@gmail.com>
---
Tested in QEMU: with -o barrier the disk gets 0 flush requests for 20 fsync() calls before the patch and 80 with it; -o nobarrier and the two remounts are the reverse.
Found and written with the help of an AI coding assistant.
fs/gfs2/ops_fstype.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 6ec47376aecf..95ac305e99ab 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -1526,7 +1526,7 @@ static int gfs2_parse_param(struct fs_context *fc, struct fs_parameter *param)
args->ar_errors = result.uint_32;
break;
case Opt_barrier:
- args->ar_nobarrier = result.boolean;
+ args->ar_nobarrier = result.negated;
break;
case Opt_rgrplvb:
args->ar_rgrplvb = result.boolean;
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
--
2.39.3 (Apple Git-146)
next reply other threads:[~2026-12-02 0:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 0:23 Yifan Feng [this message]
2026-12-02 0:39 Yifan Feng
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=20261202002354.72253-1-evanfengff@gmail.com \
--to=evanfengff@gmail.com \
--cc=agruenba@redhat.com \
--cc=anprice@redhat.com \
--cc=gfs2@lists.linux.dev \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®