The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Stefan Berger <stefanb@linux.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: Stefan Berger <stefanb@linux.ibm.com>,
	"Milton D. Miller II" <mdmii@outlook.com>,
	Rob Landley <rob@landley.net>, Jeff Layton <jlayton@kernel.org>,
	Jens Axboe <axboe@kernel.dk>, Jim Cromie <jim.cromie@gmail.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Mimi Zohar <zohar@linux.ibm.com>
Subject: [RFC PATCH] rootfs: Use tmpfs for rootfs even if root= is given
Date: Tue, 31 Oct 2023 11:44:17 -0400	[thread overview]
Message-ID: <20231031154417.621742-1-stefanb@linux.ibm.com> (raw)

rootfs currently does not use tmpfs if the root= boot option is passed
even though the documentation about rootfs (added in 6e19eded3684) in
Documentation/filesystems/ramfs-rootfs-initramfs.rst states:

  If CONFIG_TMPFS is enabled, rootfs will use tmpfs instead of ramfs by
  default.  To force ramfs, add "rootfstype=ramfs" to the kernel command
  line.

However, this currently does not work when root= is passed on the boot
command line since then saved_root_name contains a string and prevents
usage of tmpfs. Therefore, remove the check on saved_root_name to
enable tmpfs for rootfs.

Fixes: 6e19eded3684 ("initmpfs: use initramfs if rootfstype= or root= specified")
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Cc: "Milton D. Miller II" <mdmii@outlook.com>
Cc: Rob Landley <rob@landley.net>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Jim Cromie <jim.cromie@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Mimi Zohar <zohar@linux.ibm.com>
---
 init/do_mounts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index 5dfd30b13f48..6567cf5807ee 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -510,7 +510,7 @@ struct file_system_type rootfs_fs_type = {
 
 void __init init_rootfs(void)
 {
-	if (IS_ENABLED(CONFIG_TMPFS) && !saved_root_name[0] &&
+	if (IS_ENABLED(CONFIG_TMPFS) &&
 		(!root_fs_names || strstr(root_fs_names, "tmpfs")))
 		is_tmpfs = true;
 }
-- 
2.40.1


             reply	other threads:[~2023-10-31 15:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 15:44 Stefan Berger [this message]
2023-10-31 16:56 ` [RFC PATCH] rootfs: Use tmpfs for rootfs even if root= is given Greg Kroah-Hartman
     [not found]   ` <b035a00f-865a-453c-bb27-0916aada0594@linux.ibm.com>
2023-10-31 20:33     ` H. Peter Anvin
2023-10-31 21:02       ` Stefan Berger
2023-11-01 11:35   ` Rob Landley
2023-11-01 12:11     ` Stefan Berger
2023-11-01 14:48       ` Rob Landley
2023-11-01 14:16     ` Stefan Berger
2023-11-01 14:28       ` Greg Kroah-Hartman
2023-11-01 14:31         ` Mimi Zohar
2023-11-02 11:56     ` 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=20231031154417.621742-1-stefanb@linux.ibm.com \
    --to=stefanb@linux.ibm.com \
    --cc=axboe@kernel.dk \
    --cc=ebiederm@xmission.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jim.cromie@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdmii@outlook.com \
    --cc=rob@landley.net \
    --cc=sam@ravnborg.org \
    --cc=viro@zeniv.linux.org.uk \
    --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