From: Menglong Dong <menglong8.dong@gmail.com>
To: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
Kees Cook <keescook@chromium.org>,
Sami Tolvanen <samitolvanen@google.com>,
johan@kernel.org, ojeda@kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
Menglong Dong <dong.menglong@zte.com.cn>,
masahiroy@kernel.org, joe@perches.com, hare@suse.de,
Jens Axboe <axboe@kernel.dk>, Jan Kara <jack@suse.cz>,
tj@kernel.org, gregkh@linuxfoundation.org, song@kernel.org,
NeilBrown <neilb@suse.de>, Barret Rhoden <brho@google.com>,
Luis Chamberlain <mcgrof@kernel.org>,
palmerdabbelt@google.com, arnd@arndb.de, f.fainelli@gmail.com,
Rasmus Villemoes <linux@rasmusvillemoes.dk>,
wangkefeng.wang@huawei.com,
Masami Hiramatsu <mhiramat@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
vbabka@suse.cz, pmladek@suse.com,
Alexander Potapenko <glider@google.com>,
Chris Down <chris@chrisdown.name>,
"Eric W. Biederman" <ebiederm@xmission.com>,
jojing64@gmail.com, mingo@kernel.org, terrelln@fb.com,
geert@linux-m68k.org, linux-fsdevel@vger.kernel.org,
LKML <linux-kernel@vger.kernel.org>,
jeyu@kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
Josh Triplett <josh@joshtriplett.org>
Subject: Re: [PATCH v4 2/3] init/do_mounts.c: create second mount for initramfs
Date: Thu, 3 Jun 2021 23:05:08 +0800 [thread overview]
Message-ID: <CADxym3YWUBf6W4pgeSPuYKFXPXeGse0t=DW8fAm-3WvgjWkRnA@mail.gmail.com> (raw)
In-Reply-To: <20210603133015.gvr5wpbotkyhhtqx@wittgenstein>
On Thu, Jun 3, 2021 at 9:30 PM Christian Brauner
<christian.brauner@ubuntu.com> wrote:
>
[...]
>
> In fact you seem to be only using this struct you're introducing in this
> single place which makes me think that it's not needed at all. So what's
> preventing us from doing:
>
> > +
> > + return do_mount_root(root->dev_name,
> > + root->fs_name,
> > + root_mountflags & ~MS_RDONLY,
> > + root_mount_data);
> > +}
>
> int __init prepare_mount_rootfs(void)
> {
> if (is_tmpfs_enabled())
> return do_mount_root("tmpfs", "tmpfs",
> root_mountflags & ~MS_RDONLY,
> root_mount_data);
>
> return do_mount_root("ramfs", "ramfs",
> root_mountflags & ~MS_RDONLY,
> root_mount_data);
> }
It seems to make sense, but I just feel that it is a little hardcode.
What if a new file system
of rootfs arises? Am I too sensitive?
[...]
>
> This is convoluted imho. I would simply use two tiny helpers:
>
> void __init finish_mount_rootfs(void)
> {
> init_mount(".", "/", NULL, MS_MOVE, NULL);
>
> if (ramdisk_exec_exist())
> init_chroot(".");
> }
>
> void __init revert_mount_rootfs(void)
> {
> init_chdir("/");
> init_umount(".", 0);
> }
>
This looks nice.
Thanks!
Menglong Dong
next prev parent reply other threads:[~2021-06-03 15:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 14:46 [PATCH v4 0/3] init/initramfs.c: make initramfs support pivot_root menglong8.dong
2021-06-02 14:46 ` [PATCH v4 1/3] init/main.c: introduce function ramdisk_exec_exist() menglong8.dong
2021-06-02 14:46 ` [PATCH v4 2/3] init/do_mounts.c: create second mount for initramfs menglong8.dong
2021-06-03 13:30 ` Christian Brauner
2021-06-03 15:05 ` Menglong Dong [this message]
2021-06-04 9:59 ` Christian Brauner
2021-06-02 14:46 ` [PATCH v4 3/3] init/do_mounts.c: fix rootfs_fs_type with ramfs menglong8.dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADxym3YWUBf6W4pgeSPuYKFXPXeGse0t=DW8fAm-3WvgjWkRnA@mail.gmail.com' \
--to=menglong8.dong@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=bhelgaas@google.com \
--cc=brho@google.com \
--cc=chris@chrisdown.name \
--cc=christian.brauner@ubuntu.com \
--cc=dong.menglong@zte.com.cn \
--cc=ebiederm@xmission.com \
--cc=f.fainelli@gmail.com \
--cc=geert@linux-m68k.org \
--cc=glider@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=hare@suse.de \
--cc=jack@suse.cz \
--cc=jeyu@kernel.org \
--cc=joe@perches.com \
--cc=johan@kernel.org \
--cc=jojing64@gmail.com \
--cc=josh@joshtriplett.org \
--cc=keescook@chromium.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@rasmusvillemoes.dk \
--cc=masahiroy@kernel.org \
--cc=mcgrof@kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=neilb@suse.de \
--cc=ojeda@kernel.org \
--cc=palmerdabbelt@google.com \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=samitolvanen@google.com \
--cc=song@kernel.org \
--cc=terrelln@fb.com \
--cc=tj@kernel.org \
--cc=vbabka@suse.cz \
--cc=viro@zeniv.linux.org.uk \
--cc=wangkefeng.wang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).