init: Add support for rootwait timeout parameter
authorLoic Poulain <loic.poulain@linaro.org>
Sun, 13 Aug 2023 08:23:49 +0000 (10:23 +0200)
committerChristian Brauner <brauner@kernel.org>
Tue, 15 Aug 2023 09:34:23 +0000 (11:34 +0200)
commit45071e1c2897138f337000e12f2393e769f125b3
treeeb4163b3a86d87000133d2766b41b5aa080d55ab
parent45e0d4b95b65fedd18aa3e1b6571e16a2e6e0aa9
init: Add support for rootwait timeout parameter

Add an optional timeout arg to 'rootwait' as the maximum time in
seconds to wait for the root device to show up before attempting
forced mount of the root filesystem.

Use case:
In case of device mapper usage for the rootfs (e.g. root=/dev/dm-0),
if the mapper is not able to create the virtual block for any reason
(wrong arguments, bad dm-verity signature, etc), the `rootwait` param
causes the kernel to wait forever. It may however be desirable to only
wait for a given time and then panic (force mount) to cause device reset.
This gives the bootloader a chance to detect the problem and to take some
measures, such as marking the booted partition as bad (for A/B case) or
entering a recovery mode.

In success case, mounting happens as soon as the root device is ready,
unlike the existing 'rootdelay' parameter which performs an unconditional
pause.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Message-Id: <20230813082349.513386-1-loic.poulain@linaro.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Documentation/admin-guide/kernel-parameters.txt
init/do_mounts.c