@@ -2051,7 +2051,11 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
struct rdt_fs_context *ctx = rdt_fc2context(fc);
struct fs_parse_result result;
- int opt;
+ int ret, opt;
+
+ ret = vfs_parse_sb_flag(fc, param);
+ if (ret != -ENOPARAM)
+ return ret;
opt = fs_parse(fc, &rdt_fs_parameters, param, &result);
if (opt < 0)
@@ -321,7 +321,11 @@ static int afs_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
struct fs_parse_result result;
struct afs_fs_context *ctx = fc->fs_private;
- int opt;
+ int ret, opt;
+
+ ret = vfs_parse_sb_flag(fc, param);
+ if (ret != -ENOPARAM)
+ return ret;
opt = fs_parse(fc, &afs_fs_parameters, param, &result);
if (opt < 0)
@@ -81,7 +81,7 @@ static const char *const forbidden_sb_flag[] = {
/*
* Check for a common mount option that manipulates s_flags.
*/
-static int vfs_parse_sb_flag(struct fs_context *fc, struct fs_parameter *param)
+int vfs_parse_sb_flag(struct fs_context *fc, struct fs_parameter *param)
{
const char *key = param->key;
unsigned int set, clear;
@@ -105,6 +105,7 @@ static int vfs_parse_sb_flag(struct fs_context *fc, struct fs_parameter *param)
fc->sb_flags_mask |= set | clear;
return 0;
}
+EXPORT_SYMBOL(vfs_parse_sb_flag);
/**
* vfs_parse_fs_param - Add a single parameter to a superblock config
@@ -129,10 +130,6 @@ int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param)
if (!param->key)
return invalf(fc, "Unnamed parameter\n");
- ret = vfs_parse_sb_flag(fc, param);
- if (ret != -ENOPARAM)
- return ret;
-
ret = security_fs_context_parse_param(fc, param);
if (ret != -ENOPARAM)
/* Param belongs to the LSM or is disallowed by the LSM; so
@@ -561,6 +558,11 @@ static int legacy_parse_param(struct fs_context *fc, struct fs_parameter *param)
struct legacy_fs_context *ctx = fc->fs_private;
unsigned int size = ctx->data_size;
size_t len = 0;
+ int ret;
+
+ ret = vfs_parse_sb_flag(fc, param);
+ if (ret != -ENOPARAM)
+ return ret;
if (strcmp(param->key, "source") == 0) {
if (param->type != fs_value_is_string)
@@ -351,6 +351,7 @@ static int fuse_ctl_get_tree(struct fs_context *fc)
static const struct fs_context_operations fuse_ctl_context_ops = {
.get_tree = fuse_ctl_get_tree,
+ .parse_param = vfs_parse_fs_param,
};
static int fuse_ctl_init_fs_context(struct fs_context *fc)
@@ -1149,7 +1149,11 @@ static int hugetlbfs_parse_param(struct fs_context *fc, struct fs_parameter *par
struct fs_parse_result result;
char *rest;
unsigned long ps;
- int opt;
+ int ret, opt;
+
+ ret = vfs_parse_sb_flag(fc, param);
+ if (ret != -ENOPARAM)
+ return ret;
opt = fs_parse(fc, &hugetlb_fs_parameters, param, &result);
if (opt < 0)
@@ -56,7 +56,11 @@ static int proc_parse_param(struct fs_context *fc, struct fs_parameter *param)
{
struct proc_fs_context *ctx = fc->fs_private;
struct fs_parse_result result;
- int opt;
+ int ret, opt;
+
+ ret = vfs_parse_sb_flag(fc, param);
+ if (ret != -ENOPARAM)
+ return ret;
opt = fs_parse(fc, &proc_fs_parameters, param, &result);
if (opt < 0)
@@ -49,6 +49,7 @@ static void sysfs_fs_context_free(struct fs_context *fc)
static const struct fs_context_operations sysfs_fs_context_ops = {
.free = sysfs_fs_context_free,
+ .parse_param = vfs_parse_sb_flag,
.get_tree = sysfs_get_tree,
};
@@ -127,6 +127,7 @@ extern struct fs_context *fs_context_for_submount(struct file_system_type *fs_ty
struct dentry *reference);
extern struct fs_context *vfs_dup_fs_context(struct fs_context *fc);
+extern int vfs_parse_sb_flag(struct fs_context *fc, struct fs_parameter *param);
extern int vfs_parse_fs_param(struct fs_context *fc, struct fs_parameter *param);
extern int vfs_parse_fs_string(struct fs_context *fc, const char *key,
const char *value, size_t v_size);
@@ -1577,6 +1577,7 @@ static const struct super_operations mqueue_super_ops = {
static const struct fs_context_operations mqueue_fs_context_ops = {
.free = mqueue_fs_context_free,
+ .parse_param = vfs_parse_sb_flag,
.get_tree = mqueue_get_tree,
};
@@ -927,7 +927,11 @@ int cgroup1_parse_param(struct fs_context *fc, struct fs_parameter *param)
struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
struct cgroup_subsys *ss;
struct fs_parse_result result;
- int opt, i;
+ int ret, opt, i;
+
+ ret = vfs_parse_sb_flag(fc, param);
+ if (ret != -ENOPARAM)
+ return ret;
opt = fs_parse(fc, &cgroup1_fs_parameters, param, &result);
if (opt == -ENOPARAM) {
@@ -1834,7 +1834,11 @@ static int cgroup2_parse_param(struct fs_context *fc, struct fs_parameter *param
{
struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
struct fs_parse_result result;
- int opt;
+ int ret, opt;
+
+ ret = vfs_parse_sb_flag(fc, param);
+ if (ret != -ENOPARAM)
+ return ret;
opt = fs_parse(fc, &cgroup2_fs_parameters, param, &result);
if (opt < 0)
@@ -394,6 +394,7 @@ static int cpuset_get_tree(struct fs_context *fc)
}
static const struct fs_context_operations cpuset_fs_context_ops = {
+ .parse_param = vfs_parse_sb_flag,
.get_tree = cpuset_get_tree,
};
Move parsing "standard" options into filesystems' ->parse_param(). This patch doesn't change behavior. This is in preparation for allowing filesystems to reject options that they don't support. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com> --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++++- fs/afs/super.c | 6 +++++- fs/fs_context.c | 12 +++++++----- fs/fuse/control.c | 1 + fs/hugetlbfs/inode.c | 6 +++++- fs/proc/root.c | 6 +++++- fs/sysfs/mount.c | 1 + include/linux/fs_context.h | 1 + ipc/mqueue.c | 1 + kernel/cgroup/cgroup-v1.c | 6 +++++- kernel/cgroup/cgroup.c | 6 +++++- kernel/cgroup/cpuset.c | 1 + 12 files changed, 42 insertions(+), 11 deletions(-)