aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangerkun <[email protected]>2021-11-08 18:34:24 -0800
committerLinus Torvalds <[email protected]>2021-11-09 10:02:51 -0800
commit0858d7da8a09e440fb192a0239d20249a2d16af8 (patch)
treecf7e1964e9da8059da5db1242bf69839390d81cd
parent2d93a5835a37684bb6171af71a2657514539df3f (diff)
ramfs: fix mount source show for ramfs
ramfs_parse_param does not parse key "source", and will convert -ENOPARAM to 0. This will skip vfs_parse_fs_param_source in vfs_parse_fs_param, which lead always "none" mount source for ramfs. Fix it by parsing "source" in ramfs_parse_param like cgroup1_parse_param does. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: yangerkun <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--fs/ramfs/inode.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index 65e7e56005b8..df4515d39cd4 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -203,17 +203,20 @@ static int ramfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
int opt;
opt = fs_parse(fc, ramfs_fs_parameters, param, &result);
- if (opt < 0) {
+ if (opt == -ENOPARAM) {
+ opt = vfs_parse_fs_param_source(fc, param);
+ if (opt != -ENOPARAM)
+ return opt;
/*
* We might like to report bad mount options here;
* but traditionally ramfs has ignored all mount options,
* and as it is used as a !CONFIG_SHMEM simple substitute
* for tmpfs, better continue to ignore other mount options.
*/
- if (opt == -ENOPARAM)
- opt = 0;
- return opt;
+ return 0;
}
+ if (opt < 0)
+ return opt;
switch (opt) {
case Opt_mode: