]> www.infradead.org Git - nvme.git/commitdiff
bcachefs: Make read_only a mount option again, but hidden
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 28 Jun 2024 22:10:47 +0000 (18:10 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:16 +0000 (19:00 -0400)
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 <kent.overstreet@linux.dev>
fs/bcachefs/chardev.c
fs/bcachefs/fs.c
fs/bcachefs/opts.h

index 72ade3664d7b0600356cd71c8126200ac0132352..ef1f74866e23c418f32ebe7e1b14c42ee8fc940c 100644 (file)
@@ -214,19 +214,6 @@ static long bch2_ioctl_fsck_offline(struct bch_ioctl_fsck_offline __user *user_a
 
        if (arg.opts) {
                char *optstr = strndup_user((char __user *)(unsigned long) arg.opts, 1 << 16);
-               char *ro, *rest;
-
-               /*
-                * If passed a "read_only" mount option, remove it because it is
-                * no longer a valid mount option, and the filesystem will be
-                * set "read_only" regardless.
-                */
-               ro = strstr(optstr, "read_only");
-               if (ro) {
-                       rest = ro + strlen("read_only");
-                       memmove(ro, rest, strlen(rest) + 1);
-               }
-
                ret =   PTR_ERR_OR_ZERO(optstr) ?:
                        bch2_parse_mount_opts(NULL, &thr->opts, NULL, optstr);
                if (!IS_ERR(optstr))
index b734d91c44464d5be04ad043ea5fe0f1938e86dd..24fba256eb8ba32d6362d7a57d4bb116bad4f21c 100644 (file)
@@ -1800,7 +1800,8 @@ static int bch2_show_options(struct seq_file *seq, struct dentry *root)
                const struct bch_option *opt = &bch2_opt_table[i];
                u64 v = bch2_opt_get_by_id(&c->opts, i);
 
-               if (!(opt->flags & OPT_MOUNT))
+               if ((opt->flags & OPT_HIDDEN) ||
+                   !(opt->flags & OPT_MOUNT))
                        continue;
 
                if (v == bch2_opt_get_by_id(&bch2_opts_default, i))
index 840dfd756760669ad669863971afa5655a9943fa..60b93018501f9814c3504ab43bf24d7d82e5c42f 100644 (file)
@@ -63,6 +63,7 @@ enum opt_flags {
        OPT_MUST_BE_POW_2 = (1 << 7),   /* Must be power of 2 */
        OPT_SB_FIELD_SECTORS = (1 << 8),/* Superblock field is >> 9 of actual value */
        OPT_SB_FIELD_ILOG2 = (1 << 9),  /* Superblock field is ilog2 of actual value */
+       OPT_HIDDEN      = (1 << 10),
 };
 
 enum opt_type {
@@ -406,7 +407,7 @@ enum fsck_err_opts {
          BCH2_NO_SB_OPT,               BCH_SB_SECTOR,                  \
          "offset",     "Sector offset of superblock")                  \
        x(read_only,                    u8,                             \
-         OPT_FS,                                                       \
+         OPT_FS|OPT_MOUNT|OPT_HIDDEN,                                  \
          OPT_BOOL(),                                                   \
          BCH2_NO_SB_OPT,               false,                          \
          NULL,         NULL)                                           \