All of lore.kernel.org
 help / color / mirror / Atom feed
* mountinfo contents changed when rootfs is ramfs
@ 2020-08-19 11:50 Pranay Srivastava
  2020-08-21 16:38 ` Pranay Srivastava
  0 siblings, 1 reply; 2+ messages in thread
From: Pranay Srivastava @ 2020-08-19 11:50 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: mountinfo contents changed when rootfs is ramfs
  2020-08-19 11:50 mountinfo contents changed when rootfs is ramfs Pranay Srivastava
@ 2020-08-21 16:38 ` Pranay Srivastava
  0 siblings, 0 replies; 2+ messages in thread
From: Pranay Srivastava @ 2020-08-21 16:38 UTC (permalink / raw)
  To: linux-fsdevel, linux-kernel; +Cc: dhowells

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?

-- 
Regards,
Pranay Srivastava

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-21 16:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19 11:50 mountinfo contents changed when rootfs is ramfs Pranay Srivastava
2020-08-21 16:38 ` Pranay Srivastava

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.