With the help of dracut "--no-hostonly-default-device", we can have only one device being recognized (dump target) in most cases under kdump.
Now that we use a different(and simpler) approach, it's time to revert the old approach(Patch 1~4).
Xunlei Pang (8): Revert "mkdumprd: omit dracut modules in case of network dumping" Revert "mkdumprd: omit dracut modules in case of no dm target" Revert "mkdumprd: omit crypt when there is no crypt kdump target" Revert "kdumpctl: use generated rd.lvm.lv=X" kdumpctl: move is_fadump_capable() to kdump-lib.sh mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device" kdumpctl: remove some cmdline inheritage from 1st kernel module-setup: remove software iscsi cmdline generated by dracut
dracut-module-setup.sh | 5 +++++ kdump-lib.sh | 25 +++++++++++---------- kdumpctl | 56 +++++++--------------------------------------- mkdumprd | 60 +++++++------------------------------------------- 4 files changed, 34 insertions(+), 112 deletions(-)
This reverts commit fb522e972c9d26e2efdabeaed543b5b23e1866e0. --- mkdumprd | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/mkdumprd b/mkdumprd index d3ecbd6..68fe6e8 100644 --- a/mkdumprd +++ b/mkdumprd @@ -372,13 +372,12 @@ crypt_exists=0 omit_dracut_modules() { local target majmin - local dm_exists network_only + local dm_exists
# Skip fadump case is_fadump_capable && return
dm_exists=0 - network_only=1
for target in $(get_kdump_targets); do if [ -b "$target" ]; then @@ -386,9 +385,6 @@ omit_dracut_modules() # Check "dm" check_block_and_slaves is_dm $majmin && dm_exists=1 fi - - # Check nfs/ssh dumping - [[ "$target" != "nfs" && "$target" != "ssh" ]] && network_only=0 done
# Omit "crypt", BZ1451717 @@ -401,12 +397,6 @@ omit_dracut_modules() # "dm_exists=0" implies "crypt_exists=0" add_dracut_arg "--omit" "lvm dm multipath dmraid" fi - - # Further omit more modules in case of nfs/ssh dumping - if [ "$network_only" == "1" ]; then - # "network_only=1" implies "dm_exists=0" - add_dracut_arg "--omit" "iscsi fcoe fcoe-uefi" - fi }
if ! check_resettable; then
This reverts commit 821d1af0804825f01bdd540b626d81ea95a5414a. --- mkdumprd | 28 ---------------------------- 1 file changed, 28 deletions(-)
diff --git a/mkdumprd b/mkdumprd index 68fe6e8..8a2fe74 100644 --- a/mkdumprd +++ b/mkdumprd @@ -359,44 +359,16 @@ check_crypt() return 1 }
-is_dm() -{ - if [ -d "/sys/dev/block/$1/dm" ]; then - return 0 - fi - - return 1 -} - crypt_exists=0 omit_dracut_modules() { - local target majmin - local dm_exists - # Skip fadump case is_fadump_capable && return
- dm_exists=0 - - for target in $(get_kdump_targets); do - if [ -b "$target" ]; then - majmin=$(get_maj_min $target) - # Check "dm" - check_block_and_slaves is_dm $majmin && dm_exists=1 - fi - done - # Omit "crypt", BZ1451717 if [ "$crypt_exists" == "0" ]; then add_dracut_arg "--omit" "crypt" fi - - # Further omit more modules in case of no dm related target - if [ "$dm_exists" == "0" ]; then - # "dm_exists=0" implies "crypt_exists=0" - add_dracut_arg "--omit" "lvm dm multipath dmraid" - fi }
if ! check_resettable; then
This reverts commit 54a5bcc4ee86f8647fbe4c3766910fb28add5cac. --- kdump-lib.sh | 12 ------------ kdumpctl | 12 ++++++++++++ mkdumprd | 15 --------------- 3 files changed, 12 insertions(+), 27 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 3f0af91..a33f172 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,7 +6,6 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled"
perror_exit() { echo $@ >&2 @@ -482,14 +481,3 @@ get_dracut_args_target() { echo $1 | grep "--mount" | sed "s/.*--mount .(.*)/\1/" | cut -d' ' -f1 } - -is_fadump_capable() -{ - # Check if firmware-assisted dump is enabled - # if no, fallback to kdump check - if [ -f $FADUMP_ENABLED_SYS_NODE ]; then - rc=`cat $FADUMP_ENABLED_SYS_NODE` - [ $rc -eq 1 ] && return 0 - fi - return 1 -} diff --git a/kdumpctl b/kdumpctl index b7a3105..6a275e8 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,6 +13,7 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -935,6 +936,17 @@ handle_mode_switch() fi }
+is_fadump_capable() +{ + # Check if firmware-assisted dump is enabled + # if no, fallback to kdump check + if [ -f $FADUMP_ENABLED_SYS_NODE ]; then + rc=`cat $FADUMP_ENABLED_SYS_NODE` + [ $rc -eq 1 ] && return 0 + fi + return 1 +} + check_current_fadump_status() { # Check if firmware-assisted dump has been registered. diff --git a/mkdumprd b/mkdumprd index 8a2fe74..9f375e0 100644 --- a/mkdumprd +++ b/mkdumprd @@ -359,24 +359,11 @@ check_crypt() return 1 }
-crypt_exists=0 -omit_dracut_modules() -{ - # Skip fadump case - is_fadump_capable && return - - # Omit "crypt", BZ1451717 - if [ "$crypt_exists" == "0" ]; then - add_dracut_arg "--omit" "crypt" - fi -} - if ! check_resettable; then exit 1 fi
if ! check_crypt; then - crypt_exists=1 echo "Warning: Encrypted device is in dump path. User will prompted for password during second kernel boot." fi
@@ -461,8 +448,6 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
-omit_dracut_modules - dracut "${dracut_args[@]}" "$@" _rc=$? sync
This reverts commit cb38b32dfc29673caaf6987aacbe10b9ee0051ae. --- kdumpctl | 47 ++--------------------------------------------- 1 file changed, 2 insertions(+), 45 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 6a275e8..f172058 100755 --- a/kdumpctl +++ b/kdumpctl @@ -175,45 +175,6 @@ check_kdump_cpus() echo " try nr_cpus=$nr_min or larger instead" }
-# Generate rd.lvm.lv=X for the kdump targets if any. -generate_lvm_cmdlines() -{ - local lvm_cmdlines="" - - generate_lvm_cmdline() { - local majmin=$1 dev - - [ -d "/sys/dev/block/$majmin/dm" ] || return 0 - dev=/dev/mapper/$(< "/sys/dev/block/$majmin/dm/name") - - vg=$(lvm lvs --rows $dev -o vg_name --separator=* 2>/dev/null | cut -d "*" -f 2) - lv=$(lvm lvs --rows $dev -o lv_name --separator=* 2>/dev/null | cut -d "*" -f 2) - if [ -n "$vg" -a -n "$lv" ]; then - lvm_cmdlines="rd.lvm.lv=$vg/$lv $lvm_cmdlines" - fi - - return 0 - } - - for_each_block_target_all generate_lvm_cmdline - - echo "$lvm_cmdlines" -} - -# $1: function name -for_each_block_target_all() -{ - local dev majmin - - for dev in $(get_kdump_targets); do - [ -b "$dev" ] || continue - majmin=$(get_maj_min $dev) - check_block_and_slaves_all $1 $majmin - done - - return 0 -} - # This function performs a series of edits on the command line. # Store the final result in global $KDUMP_COMMANDLINE. prepare_cmdline() @@ -233,19 +194,15 @@ prepare_cmdline()
# Always remove "root=X", as we now explicitly generate all kinds # of dump target mount information including root fs. But we can - # not remove it in case of "default dump_to_rootfs". + # not remove it in case of fadump or "default dump_to_rootfs". # # We do this before KDUMP_COMMANDLINE_APPEND, if one really cares # about it(e.g. for debug purpose), then can pass "root=X" using # KDUMP_COMMANDLINE_APPEND. - if ! is_dump_to_rootfs; then + if [ $DEFAULT_DUMP_MODE != "fadump" ] && ! is_dump_to_rootfs; then cmdline=`remove_cmdline_param "$cmdline" root` fi
- # Remove all the inherited rd.lvm.lv=X and generate those as needed. - cmdline=`remove_cmdline_param "$cmdline" rd.lvm.lv` - cmdline="${cmdline} $(generate_lvm_cmdlines)" - cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
id=`get_bootcpu_apicid`
Make is_fadump_capable() a library function, as we will need it in mkdumprd.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdump-lib.sh | 12 ++++++++++++ kdumpctl | 12 ------------ 2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a33f172..19d749f 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -6,6 +6,18 @@ DEFAULT_PATH="/var/crash/" FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump" FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send" +FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" + +is_fadump_capable() +{ + # Check if firmware-assisted dump is enabled + # if no, fallback to kdump check + if [ -f $FADUMP_ENABLED_SYS_NODE ]; then + rc=`cat $FADUMP_ENABLED_SYS_NODE` + [ $rc -eq 1 ] && return 0 + fi + return 1 +}
perror_exit() { echo $@ >&2 diff --git a/kdumpctl b/kdumpctl index f172058..51d586d 100755 --- a/kdumpctl +++ b/kdumpctl @@ -13,7 +13,6 @@ DUMP_TARGET="" DEFAULT_INITRD="" DEFAULT_INITRD_BAK="" TARGET_INITRD="" -FADUMP_ENABLED_SYS_NODE="/sys/kernel/fadump_enabled" FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered" #kdump shall be the default dump mode DEFAULT_DUMP_MODE="kdump" @@ -893,17 +892,6 @@ handle_mode_switch() fi }
-is_fadump_capable() -{ - # Check if firmware-assisted dump is enabled - # if no, fallback to kdump check - if [ -f $FADUMP_ENABLED_SYS_NODE ]; then - rc=`cat $FADUMP_ENABLED_SYS_NODE` - [ $rc -eq 1 ] && return 0 - fi - return 1 -} - check_current_fadump_status() { # Check if firmware-assisted dump has been registered.
Now dracut supports "--no-hostonly-default-device" which enables us to only add the kdump target, which can avoid needless devices being recognized under kdump.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdump-lib.sh | 3 ++- mkdumprd | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 19d749f..5feac42 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -192,7 +192,8 @@ get_kdump_targets() # (say mounted to /boot, /boot/efi/, etc) plus the root device. Then kdump # must wait for these devices if initramfs is built with "--hostonly-cmdline". # - # We don't pass "--hostonly-cmdline" to dracut, so there's no problem. + # We pass "--hostonly-cmdline" together with "--no-hostonly-default-device" + # to dracut, so there's no problem.
echo "$kdump_targets" } diff --git a/mkdumprd b/mkdumprd index 9f375e0..d68a441 100644 --- a/mkdumprd +++ b/mkdumprd @@ -448,6 +448,15 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+if !is_fadump_capable; then + add_dracut_arg "--hostonly-cmdline" + add_dracut_arg "--no-hostonly-default-device" + + if is_dump_to_rootfs; then + add_dracut_arg "--add-device" "$(to_dev_name $(get_root_fs_device))" + fi +fi + dracut "${dracut_args[@]}" "$@" _rc=$? sync
With the help of "--hostonly-cmdline", dracut will generate the needed cmdlines for the dump target, so we can avoid the corresponding inheritage.
Change the code style in passing.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- kdumpctl | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 51d586d..12f360a 100755 --- a/kdumpctl +++ b/kdumpctl @@ -181,32 +181,35 @@ prepare_cmdline() local cmdline id
if [ -z "$KDUMP_COMMANDLINE" ]; then - cmdline=`cat /proc/cmdline` + cmdline=$(cat /proc/cmdline) else cmdline=${KDUMP_COMMANDLINE} fi
# These params should always be removed - cmdline=`remove_cmdline_param "$cmdline" crashkernel panic_on_warn` + cmdline=$(remove_cmdline_param "$cmdline" crashkernel panic_on_warn) # These params can be removed configurably - cmdline=`remove_cmdline_param "$cmdline" ${KDUMP_COMMANDLINE_REMOVE}` + cmdline=$(remove_cmdline_param "$cmdline" ${KDUMP_COMMANDLINE_REMOVE})
# Always remove "root=X", as we now explicitly generate all kinds # of dump target mount information including root fs. But we can - # not remove it in case of fadump or "default dump_to_rootfs". + # not remove it in case of "default dump_to_rootfs". # # We do this before KDUMP_COMMANDLINE_APPEND, if one really cares # about it(e.g. for debug purpose), then can pass "root=X" using # KDUMP_COMMANDLINE_APPEND. - if [ $DEFAULT_DUMP_MODE != "fadump" ] && ! is_dump_to_rootfs; then - cmdline=`remove_cmdline_param "$cmdline" root` + if ! is_dump_to_rootfs; then + cmdline=$(remove_cmdline_param "$cmdline" root) fi
+ # With the help of "--hostonly-cmdline", we can avoid some interitage. + cmdline=$(remove_cmdline_param "$cmdline" rd.lvm.lv rd.luks.uuid rd.dm.uuid rd.md.uuid fcoe) + cmdline="${cmdline} ${KDUMP_COMMANDLINE_APPEND}"
- id=`get_bootcpu_apicid` + id=$(get_bootcpu_apicid) if [ ! -z ${id} ] ; then - cmdline=`append_cmdline "${cmdline}" disable_cpu_apicid ${id}` + cmdline=$(append_cmdline "${cmdline}" disable_cpu_apicid ${id}) fi
KDUMP_COMMANDLINE=$cmdline
Currently 99kdump and 95iscsi both generate iscsi related cmdline, we remove that of 95iscsi and use 99kdump's, as we need to setup "kdump-eth*" in some software iscsi cases.
Signed-off-by: Xunlei Pang xlpang@redhat.com --- dracut-module-setup.sh | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index ae13337..837447d 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -612,6 +612,11 @@ kdump_check_iscsi_targets () { # If our prerequisites are not met, fail anyways. type -P iscsistart >/dev/null || return 1
+ # Remove software iscsi cmdline generated by dracut. + # Ugly: generate here mainly due to kdump_setup_ifname(). + grep "ip=ibft" ${initdir}/etc/cmdline.d/95iscsi.conf &>/dev/null + [ $? -ne 0 ] && rm -rf ${initdir}/etc/cmdline.d/95iscsi.conf + kdump_check_setup_iscsi() ( local _dev _dev=$1
On 08/28/2017 at 10:59 PM, Xunlei Pang wrote:
Now dracut supports "--no-hostonly-default-device" which enables us to only add the kdump target, which can avoid needless devices being recognized under kdump.
Signed-off-by: Xunlei Pang xlpang@redhat.com
kdump-lib.sh | 3 ++- mkdumprd | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 19d749f..5feac42 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -192,7 +192,8 @@ get_kdump_targets() # (say mounted to /boot, /boot/efi/, etc) plus the root device. Then kdump # must wait for these devices if initramfs is built with "--hostonly-cmdline". #
- # We don't pass "--hostonly-cmdline" to dracut, so there's no problem.
# We pass "--hostonly-cmdline" together with "--no-hostonly-default-device"
# to dracut, so there's no problem.
echo "$kdump_targets"
} diff --git a/mkdumprd b/mkdumprd index 9f375e0..d68a441 100644 --- a/mkdumprd +++ b/mkdumprd @@ -448,6 +448,15 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+if !is_fadump_capable; then
Sorry, missed a whitespace between "!" and "is_fadump_capable".
- add_dracut_arg "--hostonly-cmdline"
- add_dracut_arg "--no-hostonly-default-device"
- if is_dump_to_rootfs; then
add_dracut_arg "--add-device" "$(to_dev_name $(get_root_fs_device))"
- fi
+fi
dracut "${dracut_args[@]}" "$@" _rc=$? sync
On 08/28/2017 at 10:58 PM, Xunlei Pang wrote:
With the help of dracut "--no-hostonly-default-device", we can have only one device being recognized (dump target) in most cases under kdump.
Now that we use a different(and simpler) approach, it's time to revert the old approach(Patch 1~4).
This patch series has passed my tests about LUKS, iscsi, lvm, nfs, etc.
Xunlei Pang (8): Revert "mkdumprd: omit dracut modules in case of network dumping" Revert "mkdumprd: omit dracut modules in case of no dm target" Revert "mkdumprd: omit crypt when there is no crypt kdump target" Revert "kdumpctl: use generated rd.lvm.lv=X" kdumpctl: move is_fadump_capable() to kdump-lib.sh mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device" kdumpctl: remove some cmdline inheritage from 1st kernel module-setup: remove software iscsi cmdline generated by dracut
dracut-module-setup.sh | 5 +++++ kdump-lib.sh | 25 +++++++++++---------- kdumpctl | 56 +++++++--------------------------------------- mkdumprd | 60 +++++++------------------------------------------- 4 files changed, 34 insertions(+), 112 deletions(-)
Please ignore this series, I will resend later.
On 08/28/2017 at 10:58 PM, Xunlei Pang wrote:
With the help of dracut "--no-hostonly-default-device", we can have only one device being recognized (dump target) in most cases under kdump.
Now that we use a different(and simpler) approach, it's time to revert the old approach(Patch 1~4).
Xunlei Pang (8): Revert "mkdumprd: omit dracut modules in case of network dumping" Revert "mkdumprd: omit dracut modules in case of no dm target" Revert "mkdumprd: omit crypt when there is no crypt kdump target" Revert "kdumpctl: use generated rd.lvm.lv=X" kdumpctl: move is_fadump_capable() to kdump-lib.sh mkdumprd: apply dracut "--hostonly-cmdline" and "--no-hostonly-default-device" kdumpctl: remove some cmdline inheritage from 1st kernel module-setup: remove software iscsi cmdline generated by dracut
dracut-module-setup.sh | 5 +++++ kdump-lib.sh | 25 +++++++++++---------- kdumpctl | 56 +++++++--------------------------------------- mkdumprd | 60 +++++++------------------------------------------- 4 files changed, 34 insertions(+), 112 deletions(-)