* [PATCH] gfs2: Fix the inverted barrier mount option
@ 2026-12-02 0:23 Yifan Feng
0 siblings, 0 replies; 3+ messages in thread
From: Yifan Feng @ 2026-12-02 0:23 UTC (permalink / raw)
To: Andreas Gruenbacher; +Cc: Andrew Price, gfs2, linux-kernel, Yifan Feng
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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] gfs2: Fix the inverted barrier mount option
@ 2026-12-02 0:39 Yifan Feng
2026-12-02 11:59 ` Andreas Gruenbacher
0 siblings, 1 reply; 3+ messages in thread
From: Yifan Feng @ 2026-12-02 0:39 UTC (permalink / raw)
To: Andreas Gruenbacher; +Cc: Andrew Price, gfs2, linux-kernel, Yifan Feng
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)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] gfs2: Fix the inverted barrier mount option
2026-12-02 0:39 Yifan Feng
@ 2026-12-02 11:59 ` Andreas Gruenbacher
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Gruenbacher @ 2026-12-02 11:59 UTC (permalink / raw)
To: Yifan Feng; +Cc: Andrew Price, gfs2, linux-kernel
Hello,
On Wed, 2 Dec 2026 at 01:39, Yifan Feng <evanfengff@gmail.com> wrote:
> 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
thanks for the bug report; I agree with your assessment.
> 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;
I would rather get rid of result.negated in gfs2_parse_param()
altogether and use !result.boolean here.
> break;
> case Opt_rgrplvb:
> args->ar_rgrplvb = result.boolean;
>
> base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
> --
> 2.39.3 (Apple Git-146)
>
Thanks,
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-02 11:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 0:23 [PATCH] gfs2: Fix the inverted barrier mount option Yifan Feng
-- strict thread matches above, loose matches on Subject: below --
2026-12-02 0:39 Yifan Feng
2026-12-02 11:59 ` Andreas Gruenbacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox