diff mbox series

mountinfo contents changed when rootfs is ramfs

Message ID CABfyVHc=oQmZG9NuJgu1G92VQqsxkynE+S9DosQzh9r+9G1Jbg@mail.gmail.com (mailing list archive)
State New, archived
Headers show
Series mountinfo contents changed when rootfs is ramfs | expand

Commit Message

Pranay Srivastava Aug. 19, 2020, 11:50 a.m. UTC
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@redhat.com>
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

+++ 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!

Comments

Pranay Srivastava Aug. 21, 2020, 4:38 p.m. UTC | #1
On Wed, Aug 19, 2020 at 5:20 PM Pranay Srivastava
<pranay.srivastava@pantacor.com> wrote:
>
> 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@redhat.com>
> 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

Kindly let me know if the above is a regression and needs to be fixed?
diff mbox series

Patch

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