Skip to contentSkip to conversation

ramfs: fix mount source show for ramfs

PATCH Applied yangerkun 1 participant 1 message Sep 24, 2021

Subsystems (2)
lore
Share & tools
lore

yangerkun

author
#0 lore raw

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

---
 fs/ramfs/inode.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
fs/ramfs/inode.c +7 -4
index 65e7e56005b8..df4515d39cd4 100644
@@ -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:
Signature · 1 line
2.31.1