From: Vincent Mailhol <mailhol@kernel.org>
To: Jens Axboe <axboe@kernel.dk>, Davidlohr Bueso <dave@stgolabs.net>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>
Cc: linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
linux-efi@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Dave Hansen <dave.hansen@intel.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
Helge Deller <deller@gmx.de>,
Matthew Wilcox <willy@infradead.org>,
Vincent Mailhol <mailhol@kernel.org>
Subject: [PATCH v2 3/7] init: factor out root device lookup into lookup_root_device()
Date: Sun, 25 Oct 2026 14:03:13 +0100 [thread overview]
Message-ID: <20261025-discoverable-root_partitions-v2-3-fb77d0821fab@kernel.org> (raw)
In-Reply-To: <20261025-discoverable-root_partitions-v2-0-fb77d0821fab@kernel.org>
DPS root detection will also need to work if root_wait is set, meaning
that wait_for_root() needs to handle the DPS logic.
Move the early_lookup_bdev() calls and the rootwait error handling into
the new lookup_root_device() so later changes can extend the lookup
policy without duplicating the rootwait retry logic.
While at it, reword the error message to add the "VFS: " prefix.
Signed-off-by: Vincent Mailhol <mailhol@kernel.org>
---
init/do_mounts.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 95e0b3a0f711..b9814d0cc5a6 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -402,6 +402,18 @@ void __init mount_root(char *root_device_name)
}
}
+static int __init lookup_root_device(const char *root_device_name, dev_t *dev)
+{
+ int err;
+
+ err = early_lookup_bdev(root_device_name, dev);
+ if (err == -EINVAL && root_wait) {
+ pr_err("VFS: root= is invalid; disabling rootwait.\n");
+ root_wait = 0;
+ }
+ return err;
+}
+
/* wait for any asynchronous scanning to complete */
static void __init wait_for_root(char *root_device_name)
{
@@ -415,7 +427,7 @@ static void __init wait_for_root(char *root_device_name)
end = ktime_add_ms(ktime_get_raw(), root_wait);
while (!driver_probe_done() ||
- early_lookup_bdev(root_device_name, &ROOT_DEV) < 0) {
+ lookup_root_device(root_device_name, &ROOT_DEV) < 0) {
msleep(5);
if (root_wait > 0 && ktime_after(ktime_get_raw(), end))
break;
@@ -440,14 +452,9 @@ static dev_t __init parse_root_device(char *root_device_name)
if (strcmp(root_device_name, "/dev/ram") == 0)
return Root_RAM0;
- error = early_lookup_bdev(root_device_name, &dev);
- if (error) {
- if (error == -EINVAL && root_wait) {
- pr_err("Disabling rootwait; root= is invalid.\n");
- root_wait = 0;
- }
+ error = lookup_root_device(root_device_name, &dev);
+ if (error)
return 0;
- }
return dev;
}
--
2.55.0
next prev parent reply other threads:[~2026-10-25 13:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 13:03 [PATCH v2 0/7] init: discoverable root partitions Vincent Mailhol
2026-10-25 13:03 ` [PATCH v2 1/7] block: store GPT partition type UUID Vincent Mailhol
2026-10-25 13:03 ` [PATCH v2 2/7] init: add DPS root partition type UUID definitions Vincent Mailhol
2026-10-25 13:13 ` sashiko-bot
2026-10-25 15:45 ` Vincent Mailhol
2026-10-25 13:03 ` Vincent Mailhol [this message]
2026-10-25 13:03 ` [PATCH v2 4/7] init: discover root by DPS partition type UUID Vincent Mailhol
2026-10-25 13:03 ` [PATCH v2 5/7] block: skip partitions with DPS no-auto GPT attribute Vincent Mailhol
2026-10-25 13:03 ` [PATCH v2 6/7] init: add secondary DPS root partition type UUID Vincent Mailhol
2026-10-25 13:03 ` [PATCH v2 7/7] docs: document discoverable root partitions Vincent Mailhol
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=20261025-discoverable-root_partitions-v2-3-fb77d0821fab@kernel.org \
--to=mailhol@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=dave.hansen@intel.com \
--cc=dave@stgolabs.net \
--cc=deller@gmx.de \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/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