dm init: add dm-mod.waitfor to wait for asynchronously probed block devices
authorPeter Korsgaard <peter@korsgaard.com>
Wed, 16 Nov 2022 06:16:56 +0000 (07:16 +0100)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Thu, 3 Aug 2023 09:35:29 +0000 (18:35 +0900)
commit924f932ee3470223b59982948dbc85bb17d29646
tree800209c91167885f3deeadd5cfc10dcff72f055e
parent2ce84d93056a45b95cdcc80df118814a30f9ff01
dm init: add dm-mod.waitfor to wait for asynchronously probed block devices

Just calling wait_for_device_probe() is not enough to ensure that
asynchronously probed block devices are available (E.G. mmc, usb), so
add a "dm-mod.waitfor=<device1>[,..,<deviceN>]" parameter to get
dm-init to explicitly wait for specific block devices before
initializing the tables with logic similar to the rootwait logic that
was introduced with commit  cc1ed7542c8c ("init: wait for
asynchronously scanned block devices").

E.G. with dm-verity on mmc using:
dm-mod.waitfor="PARTLABEL=hash-a,PARTLABEL=root-a"

[    0.671671] device-mapper: init: waiting for all devices to be available before creating mapped devices
[    0.671679] device-mapper: init: waiting for device PARTLABEL=hash-a ...
[    0.710695] mmc0: new HS200 MMC card at address 0001
[    0.711158] mmcblk0: mmc0:0001 004GA0 3.69 GiB
[    0.715954] mmcblk0boot0: mmc0:0001 004GA0 partition 1 2.00 MiB
[    0.722085] mmcblk0boot1: mmc0:0001 004GA0 partition 2 2.00 MiB
[    0.728093] mmcblk0rpmb: mmc0:0001 004GA0 partition 3 512 KiB, chardev (249:0)
[    0.738274]  mmcblk0: p1 p2 p3 p4 p5 p6 p7
[    0.751282] device-mapper: init: waiting for device PARTLABEL=root-a ...
[    0.751306] device-mapper: init: all devices available
[    0.751683] device-mapper: verity: sha256 using implementation "sha256-generic"
[    0.759344] device-mapper: ioctl: dm-0 (vroot) is ready
[    0.766540] VFS: Mounted root (squashfs filesystem) readonly on device 254:0.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
[jh80.chung: cherry picked from commit 035641b01e72af4f6c6cf22a4bdb5d7dfc4e8e8e]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Ib918a6f474842b1ae633225a7781839e7ffaade4
Documentation/admin-guide/device-mapper/dm-init.rst
drivers/md/dm-init.c