From: Francesco Valla <francesco@valla.it>
To: Guillaume Gonnet <ggonnet.linux@gmail.com>
Cc: Alasdair Kergon <agk@redhat.com>,
Mike Snitzer <snitzer@kernel.org>,
Mikulas Patocka <mpatocka@redhat.com>,
Benjamin Marzinski <bmarzins@redhat.com>,
Peter Korsgaard <peter@korsgaard.com>,
dm-devel@schwermer.no, chanho.min@lge.com, jaeyuel.im@lge.com,
dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dm init: ensure device probing has finished in dm-mod.waitfor=
Date: Thu, 26 Mar 2026 22:40:51 +0100 [thread overview]
Message-ID: <acWk8Gq7DJYTCcIW@bywater> (raw)
In-Reply-To: <20260317213229.18371-1-ggonnet.linux@gmail.com>
Hello Guillaume,
On Tue, Mar 17, 2026 at 10:32:28PM +0100, Guillaume Gonnet wrote:
> The early_lookup_bdev() function returns successfully when the disk
> device is present but not necessarily its partitions. In this situation,
> dm_early_create() fails as the partition block device does not exist
> yet.
>
> In my case, this phenomenon occurs quite often because the device is
> an SD card with slow reading times, on which kernel takes time to
> enumerate available partitions.
>
I am now in the same situation, but I have seen the behavior also on
"fast" eMMC devices probing on slow single-core processors.
> Fortunately, the underlying device is back to "probing" state while
> enumerating partitions. Waiting for all probing to end is enough to fix
> this issue.
>
> That's also the reason why this problem never occurs with rootwait=
> parameter: the while loop inside wait_for_root() explicitly waits for
> probing to be done and then the function calls async_synchronize_full().
> These lines were omitted in 035641b, even though the commit says it's
> based on the rootwait logic...
>
> Anyway, calling wait_for_device_probe() after our while loop does the
> job (it both waits for probing and calls async_synchronize_full).
>
> Fixes: 035641b01e72 ("dm init: add dm-mod.waitfor to wait for asynchronously probed block devices")
> Signed-off-by: Guillaume Gonnet <ggonnet.linux@gmail.com>
> ---
>
> Hello,
>
> This patch is my attempt to fix the dm-mod.waitfor= issue. I had this
> fix for quite a while now, but I've never made the effort to contribute
> until recently.
>
> Some have tried to fix it this issue in the past but without finding
> its real root cause (ie. not waiting for device probe to end).
>
> Here are the links to those patches, for reference:
> https://lore.kernel.org/all/b5c5cd56-b9dd-4368-a8e1-b9e0a07b79b4@schwermer.no/
> https://lore.kernel.org/all/20250410080056.43247-1-chanho.min@lge.com/
> https://lore.kernel.org/dm-devel/20251211073426.123026-1-jaeyuel.im@lge.com/
>
> drivers/md/dm-init.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c
> index 7403823384c5..c1bacba92c65 100644
> --- a/drivers/md/dm-init.c
> +++ b/drivers/md/dm-init.c
> @@ -303,8 +303,10 @@ static int __init dm_init_init(void)
> }
> }
>
> - if (waitfor[0])
> + if (waitfor[0]) {
> + wait_for_device_probe();
> DMINFO("all devices available");
> + }
>
> list_for_each_entry(dev, &devices, list) {
> if (dm_early_create(&dev->dmi, dev->table,
> --
> 2.43.0
>
Reviewed-by: Francesco Valla <francesco@valla.it>
Tested-by: Francesco Valla <francesco@valla.it>
Thank you!
Regards,
Francesco
next prev parent reply other threads:[~2026-03-26 22:54 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 21:32 Guillaume Gonnet
2026-03-18 8:22 ` Peter Korsgaard
2026-03-18 9:25 ` Guillaume GONNET
2026-03-18 16:36 ` Mikulas Patocka
2026-03-18 17:57 ` Peter Korsgaard
2026-03-18 21:13 ` Mikulas Patocka
2026-03-19 8:47 ` Guillaume Gonnet
2026-03-19 10:53 ` Peter Korsgaard
2026-03-26 21:40 ` Francesco Valla [this message]
[not found] ` <abtakh4sU3HldDBB@BRUNHILD>
[not found] ` <DH6N0QM6764O.2CZNT5C8VH6Y1@gmail.com>
2026-03-27 4:33 ` Chanho Min
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=acWk8Gq7DJYTCcIW@bywater \
--to=francesco@valla.it \
--cc=agk@redhat.com \
--cc=bmarzins@redhat.com \
--cc=chanho.min@lge.com \
--cc=dm-devel@lists.linux.dev \
--cc=dm-devel@schwermer.no \
--cc=ggonnet.linux@gmail.com \
--cc=jaeyuel.im@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=peter@korsgaard.com \
--cc=snitzer@kernel.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
all inboxes | Powered by JetHome®