opt_set(opts, read_only, (*flags & SB_RDONLY) != 0);
- ret = bch2_parse_mount_opts(&opts, data);
+ ret = bch2_parse_mount_opts(c, &opts, data);
if (ret)
return ret;
opt_set(opts, read_only, (flags & SB_RDONLY) != 0);
- ret = bch2_parse_mount_opts(&opts, data);
+ ret = bch2_parse_mount_opts(NULL, &opts, data);
if (ret)
return ERR_PTR(ret);
goto got_sb;
c = bch2_fs_open(devs, nr_devs, opts);
-
- if (!IS_ERR(c))
- sb = sget(fs_type, NULL, bch2_set_super, flags|SB_NOSEC, c);
- else
+ if (IS_ERR(c)) {
sb = ERR_CAST(c);
+ goto got_sb;
+ }
+
+ /* Some options can't be parsed until after the fs is started: */
+ ret = bch2_parse_mount_opts(c, &opts, data);
+ if (ret) {
+ bch2_fs_stop(c);
+ sb = ERR_PTR(ret);
+ goto got_sb;
+ }
+
+ bch2_opts_apply(&c->opts, opts);
+
+ sb = sget(fs_type, NULL, bch2_set_super, flags|SB_NOSEC, c);
+ if (IS_ERR(sb))
+ bch2_fs_stop(c);
got_sb:
kfree(devs_to_fs);
kfree(devs[0]);
break;
case BCH_OPT_FN:
if (!c)
- return -EINVAL;
+ return 0;
return opt->parse(c, val, res);
}
return 0;
}
-int bch2_parse_mount_opts(struct bch_opts *opts, char *options)
+int bch2_parse_mount_opts(struct bch_fs *c, struct bch_opts *opts,
+ char *options)
{
char *opt, *name, *val;
int ret, id;
if (id < 0)
goto bad_opt;
- ret = bch2_opt_parse(NULL, &bch2_opt_table[id], val, &v);
+ ret = bch2_opt_parse(c, &bch2_opt_table[id], val, &v);
if (ret < 0)
goto bad_val;
} else {
int bch2_opt_check_may_set(struct bch_fs *, int, u64);
int bch2_opts_check_may_set(struct bch_fs *);
-int bch2_parse_mount_opts(struct bch_opts *, char *);
+int bch2_parse_mount_opts(struct bch_fs *, struct bch_opts *, char *);
/* inode opts: */