mountinfo contents changed when rootfs is ramfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I'm running a system where rootfs is ramfs. For kernel version 5.2.11

# cat /proc/self/mountinfo
0 0 0:1 / / rw - rootfs rootfs rw
%<---snip>%

while for kernel 5.4.58
# cat /proc/self/mountinfo
0 0 0:1 / / rw - rootfs none rw
%<---snip>%

The reason for the above difference is because for kernel 5.2.11 the
parse_param for
rootfs was set to legacy_parse_param which handled the "source" param
instead of
ignoring it.

With kernel 5.4.58 this is set to ramfs_parse_param which ignores any
parameters not
recognized and also returns 0 instead of -ENOPARAM. This causes
vfs_parse_fs_param
to not set the file context  source(fc->source) which results in "none" from
alloc_vfs_mount(fc->source ? : "none")

The commit which introduced the above change was

commit f32356261d44d580649a7abce1156d15d49cf20f
Author: David Howells <dhowells@xxxxxxxxxx>
Date:   Mon Mar 25 16:38:31 2019 +0000

    vfs: Convert ramfs, shmem, tmpfs, devtmpfs, rootfs to use the new mount API

I'm not sure if this is a regression? But if it is, do we handle it like

diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index ee179a81b3da..47a39baa0535 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c

@@ -200,7 +200,7 @@ static int ramfs_parse_param(struct fs_context
*fc, struct fs_parameter *param)
                 * and as it is used as a !CONFIG_SHMEM simple substitute
                 * for tmpfs, better continue to ignore other mount options.
                 */
-               if (opt == -ENOPARAM)
+               if (opt == -ENOPARAM && strcmp(param->key, "source"))
                        opt = 0;
                return opt;
        }

so that mountinfo gives the same information as for earlier kernels.

Thanks!
-- 
Regards,
Pranay Srivastava



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux