public inbox for initramfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: Askar Safin <safinaskar@gmail.com>, Rob Landley <rob@landley.net>
Cc: gregkh@linuxfoundation.org, initramfs@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	zohar@linux.ibm.com
Subject: Re: [PATCH v3] rootfs: Fix support for rootfstype= when root= is given
Date: Fri, 29 Dec 2023 11:39:14 -0500	[thread overview]
Message-ID: <fb776d99-1956-4e1b-9afc-84f27ca40f46@linux.ibm.com> (raw)
In-Reply-To: <CAPnZJGBeV-E_AN8GnTfkaJvRtBmCeMYYCt+O0XMsc3kDULRuKg@mail.gmail.com>



On 12/21/23 17:58, Askar Safin wrote:
> Hi, Rob. And Stefan.
> 
> First of all, this patch got to linux-next (
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/?qt=author&q=Stefan+Berger
> ), so it seems it soon will be in mainline.
> 
> On Thu, Dec 21, 2023 at 12:24 PM Rob Landley <rob@landley.net> wrote:
>> Can you build tmpfs on a nommu system? Last I checked the plumbing expects swap,
>> but it's been a while...
> Okay, I agree, let's not remove ramfs.
> 
> Still, I don't like this (already applied) patch. init= and rdinit=
> are two different options, and this is good. So, I think we should
> have two different options. Analogously they should be rootfstype= and
> rdrootfstype=. rootfstype= should be read by kernel when deciding how
> to mount real root (i. e. not initramfs or initrd) only and
> rdrootfstype= when deciding how to mount initramfs only. This will
> make everything cleaner. Also note that userspace tools read
> rootfstype= and assume that it always applies to real root. For
> example, this is Debian's rdinit:
> 
> https://salsa.debian.org/kernel-team/initramfs-tools/-/blob/cf964bfb4362019fd7fba1e839e403ff950dca8e/init#L103
> 
> As you can see, this shell script parses /proc/cmdline and assumes
> that rootfstype= always applies to real root. So, if someone sets
> rootfstype= to tmpfs or ramfs, this will likely break this script.

Setting the kernel boot command line option rootfstype= to tmpfs or 
ramfs was possible so far and that's what the documentation and code 
supported so far as well. The bug surfaced when root= was provided, in 
which case it was ignored.

> 
> So, I think the code should look so:
> 
> +if (IS_ENABLED(CONFIG_TMPFS)) {
> +        if (!rd_root_fs_names) // We assume rd_root_fs_names is set
> by rdrootfstype=
> +                is_tmpfs = true; // Use tmpfs if rdrootfstype= is not
> set. To get all tmpfs benefits
> +        else if (rd_root_fs_names && !!strstr(rd_root_fs_names, "tmpfs"))
> +                is_tmpfs = true;
> +}
> 
> Yes, this will slightly break compatibility. I. e. this will make
> Linux always choose tmpfs if rdrootfstype= is not present. But I think

You may find someone who doesn't like this change, either, ...

> there is nothing wrong with it. If a user cares, he will set
> rdrootfstype= . And early boot code will become a lot more clean and
> logical.
> 
> Rob, do you agree? Stefan, do you agree? Then I will write a patch,

... but go ahead.

> with doc changes (currently I use gmail web interface, of course I
> will use git send-email when I sent actual patch)
> 

  reply	other threads:[~2023-12-29 16:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-20  2:19 [PATCH v3] rootfs: Fix support for rootfstype= when root= is given Askar Safin
2023-12-21  9:30 ` Rob Landley
2023-12-21 22:58   ` Askar Safin
2023-12-29 16:39     ` Stefan Berger [this message]
2023-12-29 18:35       ` Rob Landley
2023-12-29 19:14         ` Stefan Berger
2023-12-30 17:08           ` Rob Landley
2023-12-31  0:46             ` Askar Safin
2024-01-01 17:48               ` Rob Landley
2024-01-03  6:18                 ` Askar Safin
2023-12-31 16:03             ` Stefan Berger
2024-01-01  1:15               ` Askar Safin
2024-01-01 18:50               ` Rob Landley
2024-01-02 13:03                 ` Stefan Berger
2024-01-04  6:06             ` Askar Safin
2024-01-04 16:38               ` Rob Landley
2023-12-30  2:10         ` Askar Safin
  -- strict thread matches above, loose matches on Subject: below --
2023-11-20  1:12 Stefan Berger
2023-11-28  9:54 ` Greg KH
2023-11-28 12:18   ` Mimi Zohar

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=fb776d99-1956-4e1b-9afc-84f27ca40f46@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=initramfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob@landley.net \
    --cc=safinaskar@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=zohar@linux.ibm.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