Re: [PATCH v6 2/2] init/do_mounts.c: create second mount for initramfs

From: menglong8 . dong
Date: Mon Jun 07 2021 - 08:16:28 EST


On Mon, Jun 07, 2021 at 12:31:47PM +0200, Christian Brauner wrote:
> On Sat, Jun 05, 2021 at 10:47:07PM +0800, Menglong Dong wrote:
[...]
> >
> > I think it's necessary, as I explained in the third patch. When the rootfs
> > is a block device, ramfs is used in init_mount_tree() unconditionally,
> > which can be seen from the enable of is_tmpfs.
> >
> > That makes sense, because rootfs will not become the root if a block
> > device is specified by 'root' in boot cmd, so it makes no sense to use
> > tmpfs, because ramfs is more simple.
> >
> > Here, I make rootfs as ramfs for the same reason: the first mount is not
> > used as the root, so make it ramfs which is more simple.
>
> Ok. If you don't mind I'd like to pull and test this before moving
> further. (Btw, I talked about this at Plumbers before btw.)
> What did you use for testing this? Any way you can share it?

Ok, no problem definitely. I tested this function in 3 way mainly:

1. I debug the kernel with qemu and gdb, and trace the the whole
process, to ensure that there is no abnormal situation.
2. I tested pivot_root() in initramfs and ensured that it can be
used normally. What's more, I also tested docker and ensured
container can run normally without 'DOCKER_RAMDISK=yes' set in
initramfs.
3. I tried to enable and disable CONFIG_INITRAMFS_MOUNT, and
ensured that the system can boot successfully from initramfs, initrd
and sda.

What's more, our team is going to test it comprehensively, such as
ltp, etc.

Thanks!
Menglong Dong