linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] ramfs: fix mount source show for ramfs
@ 2021-09-24  9:17 yangerkun
  0 siblings, 0 replies; only message in thread
From: yangerkun @ 2021-09-24  9:17 UTC (permalink / raw)
  To: viro, akpm; +Cc: linux-mm, linux-fsdevel, yangerkun, yukuai3

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 parse "source" in ramfs_parse_param like cgroup1_parse_param has
do.

Signed-off-by: yangerkun <yangerkun@huawei.com>
---
 fs/ramfs/inode.c | 11 +++++++----
 1 file 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:
-- 
2.31.1



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-24  9:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-24  9:17 [PATCH v2] ramfs: fix mount source show for ramfs yangerkun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox