Skip to content

Commit 6f866e9

Browse files
Guillaume Gonnetgregkh
authored andcommitted
dm init: ensure device probing has finished in dm-mod.waitfor=
[ Upstream commit 99a2312 ] 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. 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: 035641b ("dm init: add dm-mod.waitfor to wait for asynchronously probed block devices") Signed-off-by: Guillaume Gonnet <ggonnet.linux@gmail.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5af3d8f commit 6f866e9

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/md/dm-init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,10 @@ static int __init dm_init_init(void)
303303
}
304304
}
305305

306-
if (waitfor[0])
306+
if (waitfor[0]) {
307+
wait_for_device_probe();
307308
DMINFO("all devices available");
309+
}
308310

309311
list_for_each_entry(dev, &devices, list) {
310312
if (dm_early_create(&dev->dmi, dev->table,

0 commit comments

Comments
 (0)