]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ramfs: fix mount source show for ramfs
authoryangerkun <yangerkun@huawei.com>
Tue, 9 Nov 2021 02:34:24 +0000 (18:34 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Nov 2021 18:02:51 +0000 (10:02 -0800)
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/20210924091756.1906118-1-yangerkun@huawei.com
Signed-off-by: yangerkun <yangerkun@huawei.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ramfs/inode.c

index 65e7e56005b8f565f272a53d379d5b87065af3a4..df4515d39cd4685aa2ef438b6ea2195bba1d19f2 100644 (file)
@@ -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: