Skip to content

Commit b1d63b0

Browse files
author
Kent Overstreet
committed
bcachefs: Make read_only a mount option again, but hidden
fsck passes read_only as a mount option, and it's required for nochanges, which it also uses. Usually read_only is handled by the VFS, but we need to be able to handle it too; we just don't want to print it out twice, so mark it as a hidden option. Signed-off-by: Kent Overstreet <[email protected]>
1 parent 9d9d212 commit b1d63b0

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

fs/bcachefs/chardev.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,6 @@ static long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_a
214214

215215
if (arg.opts) {
216216
char *optstr = strndup_user((char __user *)(unsigned long) arg.opts, 1 << 16);
217-
char *ro, *rest;
218-
219-
/*
220-
* If passed a "read_only" mount option, remove it because it is
221-
* no longer a valid mount option, and the filesystem will be
222-
* set "read_only" regardless.
223-
*/
224-
ro = strstr(optstr, "read_only");
225-
if (ro) {
226-
rest = ro + strlen("read_only");
227-
memmove(ro, rest, strlen(rest) + 1);
228-
}
229-
230217
ret = PTR_ERR_OR_ZERO(optstr) ?:
231218
bch2_parse_mount_opts(NULL, &thr->opts, NULL, optstr);
232219
if (!IS_ERR(optstr))

fs/bcachefs/fs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,8 @@ static int bch2_show_options(struct seq_file *seq, struct dentry *root)
18001800
const struct bch_option *opt = &bch2_opt_table[i];
18011801
u64 v = bch2_opt_get_by_id(&c->opts, i);
18021802

1803-
if (!(opt->flags & OPT_MOUNT))
1803+
if ((opt->flags & OPT_HIDDEN) ||
1804+
!(opt->flags & OPT_MOUNT))
18041805
continue;
18051806

18061807
if (v == bch2_opt_get_by_id(&bch2_opts_default, i))

fs/bcachefs/opts.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ enum opt_flags {
6363
OPT_MUST_BE_POW_2 = (1 << 7), /* Must be power of 2 */
6464
OPT_SB_FIELD_SECTORS = (1 << 8),/* Superblock field is >> 9 of actual value */
6565
OPT_SB_FIELD_ILOG2 = (1 << 9), /* Superblock field is ilog2 of actual value */
66+
OPT_HIDDEN = (1 << 10),
6667
};
6768

6869
enum opt_type {
@@ -406,7 +407,7 @@ enum fsck_err_opts {
406407
BCH2_NO_SB_OPT, BCH_SB_SECTOR, \
407408
"offset", "Sector offset of superblock") \
408409
x(read_only, u8, \
409-
OPT_FS, \
410+
OPT_FS|OPT_MOUNT|OPT_HIDDEN, \
410411
OPT_BOOL(), \
411412
BCH2_NO_SB_OPT, false, \
412413
NULL, NULL) \

0 commit comments

Comments
 (0)