From f2c82bf2b5043313174d13ca464ee670b9a19681 Mon Sep 17 00:00:00 2001 From: Steffen Maier Date: Thu, 19 Jan 2023 19:09:04 +0100 Subject: [PATCH] zdev/dracut: fix hardcoded '/' as required mount or device MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the introduction of zdev for device configuration in v1.33.0, it used a hardcoded "/" to refer to the root-fs. Dracut has its own mechanism to find the root file system and to walk its device dependencies. Mkdumprd also has its own mechanism to interpret the kdump target and invokes dracut so that dracut only considers arguments from mkdumprd without any root-fs dracut would default to [--no-hostonly-default-device]. Use the dracut mechanism to walk device dependencies and individually have chzdev treat each leaf-node in the dependency tree. See also https://github.com/dracutdevs/dracut commit 83e0dc7a3dca ("Add for_each_host_dev_and_slaves for device only checking"). This enables the use of dracut options such as --add-device or --mount used in turn by mkdumprd. Reviewed-by: Peter Oberparleiter Signed-off-by: Steffen Maier Signed-off-by: Jan Höppner --- zdev/dracut/95zdev/module-setup.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/zdev/dracut/95zdev/module-setup.sh b/zdev/dracut/95zdev/module-setup.sh index e1f00c31..84d8933f 100644 --- a/zdev/dracut/95zdev/module-setup.sh +++ b/zdev/dracut/95zdev/module-setup.sh @@ -50,8 +50,18 @@ install() { # Obtain early + root device configuration _tempfile=$(mktemp --tmpdir dracut-zdev.XXXXXX) - chzdev --export "$_tempfile" --persistent --by-path / --quiet \ - --type 2>/dev/null + function check_zdev() { + local _dev=$1 + local _devsysfs _bdevpath + _devsysfs=$( + cd -P /sys/dev/block/"$_dev" && echo "$PWD" + ) + _bdevpath=/dev/${_devsysfs##*/} + chzdev --export - --persistent --by-node "$_bdevpath" --quiet \ + --type 2>/dev/null >> "$_tempfile" + } + for_each_host_dev_and_slaves_all check_zdev + chzdev --export - --persistent --by-attrib "zdev:early=1" --quiet \ --type 2>/dev/null >> "$_tempfile"