]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bcachefs: don't expose "read_only" as a mount option
authorThomas Bertschinger <tahbertschinger@gmail.com>
Sun, 26 May 2024 19:08:20 +0000 (13:08 -0600)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:12 +0000 (19:00 -0400)
commitbabe30fe8db62b79f7e3df4144acc344b3672f60
tree0faa0866a390b18480e7589a15d10223fe7eb68a
parent03ec0927fa15e1af1268c8637f61b0ac98082907
bcachefs: don't expose "read_only" as a mount option

When "read_only" is exposed as a mount option, it is redundant with the
standard option "ro" and gives users multiple ways to specify that a
bcachefs filesystem should be mounted read-only. This presents the risk
of having inconsistent options specified.

This can be seen when remounting a read-only filesystem in read-write
mode, using mount(8) from util-linux. Because mount(8) parses the
existing mount options from `/proc/mounts` and applies them when
remounting, it can end up applying both "read_only" and "rw":

$ mount img -o ro /mnt
$ strace mount -o remount,rw /mnt
...
fsconfig(4, FSCONFIG_SET_FLAG, "read_only", NULL, 0) = 0
fsconfig(4, FSCONFIG_SET_FLAG, "rw", NULL, 0) = 0
...

Making "read_only" no longer a mount option means this edge case cannot
occur.

Fixes: 62719cf33c3a ("bcachefs: Fix nochanges/read_only interaction")
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/opts.h