Skip to content

Commit 0858d7d

Browse files
yangerkuntorvalds
authored andcommitted
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/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>
1 parent 2d93a58 commit 0858d7d

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎fs/ramfs/inode.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,20 @@ static int ramfs_parse_param(struct fs_context *fc, struct fs_parameter *param)
203203
int opt;
204204

205205
opt = fs_parse(fc, ramfs_fs_parameters, param, &result);
206-
if (opt < 0) {
206+
if (opt == -ENOPARAM) {
207+
opt = vfs_parse_fs_param_source(fc, param);
208+
if (opt != -ENOPARAM)
209+
return opt;
207210
/*
208211
* We might like to report bad mount options here;
209212
* but traditionally ramfs has ignored all mount options,
210213
* and as it is used as a !CONFIG_SHMEM simple substitute
211214
* for tmpfs, better continue to ignore other mount options.
212215
*/
213-
if (opt == -ENOPARAM)
214-
opt = 0;
215-
return opt;
216+
return 0;
216217
}
218+
if (opt < 0)
219+
return opt;
217220

218221
switch (opt) {
219222
case Opt_mode:

0 commit comments

Comments
 (0)