From c755499fad6f48354017f7fbe577e92b4a2bd407 Mon Sep 17 00:00:00 2001 From: Pingfan Liu Date: Thu, 23 Nov 2017 10:17:54 +0800 Subject: [PATCH] dracut-module-setup.sh: check whether to include multipath-hostonly or not Due to the following commit in dracut, which splits out hostonly modules commit 5ce7cc7337a4c769b223152c083914f2052aa348 Author: Harald Hoyer Date: Mon Jul 10 13:28:40 2017 +0200 add 90multipath-hostonly module hardcoding the wwid of the drives in the initramfs causes problems when the drives are cloned to a system with the same hardware, but different disk wwid's https://bugzilla.redhat.com/show_bug.cgi?id=1457311 So kdump should decide whether to include the hostonly module. The multipath-hostonly can help kdump to include only the needed mpath device, in order to use less memory by 2nd kernel. ---- The performance ----- before this patch [root@localhost ~]# time kdumpctl start Detected change(s) in the following file(s): /etc/kdump.conf Rebuilding /boot/initramfs-4.13.9-300.fc27.x86_64kdump.img kexec: loaded kdump kernel Starting kdump: [OK] real 0m12.485s user 0m10.096s sys 0m1.887s after this patch root@localhost ~]# time kdumpctl start Detected change(s) in the following file(s): /etc/kdump.conf Rebuilding /boot/initramfs-4.13.9-300.fc27.x86_64kdump.img kexec: loaded kdump kernel Starting kdump: [OK] real 0m15.839s user 0m13.015s sys 0m1.853s Signed-off-by: Pingfan Liu Acked-by: Dave Young --- dracut-module-setup.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 0c3609f..c0f1a88 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -7,6 +7,13 @@ if ! [[ -d "${initdir}/tmp" ]]; then mkdir -p "${initdir}/tmp" fi +is_mpath() { + local _dev=$1 + [ -e /sys/dev/block/$_dev/dm/uuid ] || return 1 + [[ $(cat /sys/dev/block/$_dev/dm/uuid) =~ mpath- ]] && return 0 + return 1 +} + check() { [[ $debug ]] && set -x #kdumpctl sets this explicitly @@ -28,6 +35,7 @@ depends() { _dep="$_dep network" fi + for_each_host_dev_and_slaves is_mpath && _dep="$_dep multipath-hostonly" echo $_dep return 0 }