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(simpler and better) 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(-)
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
On 08/30/2017 at 10:12 AM, Xunlei Pang wrote:
This reverts commit fb522e972c9d26e2efdabeaed543b5b23e1866e0.
For better understanding, here is the improved changelog: We are going to add "--no-hostonly-default-device" dracut argument in the following patch.
With the help of "--no-hostonly-default-device", dracut only adds the dump target as host devices, which naturally guarantees only required dracut modules being selected.
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 2ad786c..fba6231 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" @@ -942,6 +943,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 fba6231..9c7e8dc 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`
On 08/30/2017 at 10:12 AM, Xunlei Pang wrote:
This reverts commit cb38b32dfc29673caaf6987aacbe10b9ee0051ae.
For better understanding, here is the improved changelog: We are going to add "--hostonly-cmdline" dracut argument in the following patch.
With the help of "--hostonly-cmdline", dracut will generate "rd.lvm.lv=X" for us, no need to implement here again.
kdumpctl | 47 ++--------------------------------------------- 1 file changed, 2 insertions(+), 45 deletions(-)
diff --git a/kdumpctl b/kdumpctl index fba6231..9c7e8dc 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 9c7e8dc..4c11bc9 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" @@ -900,17 +899,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 --- Note that "--no-hostonly-default-device" feature was merged in "dracut-046-7.git20170824.fc28".
kdump-lib.sh | 8 -------- kexec-tools.spec | 2 +- mkdumprd | 10 +++++++++- 3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 19d749f..d981c4f 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -186,14 +186,6 @@ get_kdump_targets() kdump_targets="$kdump_targets $_root" fi
- # NOTE: - # dracut parses devices from "/etc/fstab" with the "x-initrd.mount" option, - # which will be added as host_devs, it also includes usually simple devices - # (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. - echo "$kdump_targets" }
diff --git a/kexec-tools.spec b/kexec-tools.spec index 1a37ef9..f356e32 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -47,7 +47,7 @@ Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(pre): coreutils sed zlib -Requires: dracut >= 044-117 +Requires: dracut >= 046-7 Requires: dracut-network >= 044-117 Requires: ethtool BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel diff --git a/mkdumprd b/mkdumprd index 9f375e0..37aaf9f 100644 --- a/mkdumprd +++ b/mkdumprd @@ -37,7 +37,7 @@ is_wdt_addition_needed [[ $? -eq 0 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) +dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() { @@ -448,6 +448,14 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+if ! is_fadump_capable; then + 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/30/2017 at 10:12 AM, 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
For better understanding, here is the improved changelog: Dracut has "--hostonly-cmdline" which can generate cmdlines(if any) regarding the dump target, it's an existing way for us to use to simplify the code. E.g. We already removed generate_lvm_cmdlines(), to use "--hostonly-cmdline".
But "--hostonly-cmdline" has other issues(e.g. BZ1451717), it adds needless devices for kdump like root device.
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. Thus "--hostonly-cmdline" side effects can be avoided with the help of "--no-hostonly-default-device".
This patch applies dracut's "--hostonly-cmdline" together with "--no-hostonly-default-device" to achieve above-mentioned purpose.
Note that "--no-hostonly-default-device" feature was merged in "dracut-046-7.git20170824.fc28".
kdump-lib.sh | 8 -------- kexec-tools.spec | 2 +- mkdumprd | 10 +++++++++- 3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index 19d749f..d981c4f 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -186,14 +186,6 @@ get_kdump_targets() kdump_targets="$kdump_targets $_root" fi
- # NOTE:
- # dracut parses devices from "/etc/fstab" with the "x-initrd.mount" option,
- # which will be added as host_devs, it also includes usually simple devices
- # (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.
- echo "$kdump_targets"
}
diff --git a/kexec-tools.spec b/kexec-tools.spec index 1a37ef9..f356e32 100644 --- a/kexec-tools.spec +++ b/kexec-tools.spec @@ -47,7 +47,7 @@ Requires(post): systemd-units Requires(preun): systemd-units Requires(postun): systemd-units Requires(pre): coreutils sed zlib -Requires: dracut >= 044-117 +Requires: dracut >= 046-7 Requires: dracut-network >= 044-117 Requires: ethtool BuildRequires: zlib-devel zlib zlib-static elfutils-devel-static glib2-devel bzip2-devel ncurses-devel bison flex lzo-devel snappy-devel diff --git a/mkdumprd b/mkdumprd index 9f375e0..37aaf9f 100644 --- a/mkdumprd +++ b/mkdumprd @@ -37,7 +37,7 @@ is_wdt_addition_needed [[ $? -eq 0 ]] && WDTCFG="-a watchdog"
extra_modules="" -dracut_args=("--hostonly" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) +dracut_args=("--hostonly" "--hostonly-cmdline" "--hostonly-i18n" "-o" "plymouth dash resume ifcfg" $WDTCFG) OVERRIDE_RESETTABLE=0
add_dracut_arg() { @@ -448,6 +448,14 @@ then add_dracut_arg "--add-drivers" "$extra_modules" fi
+if ! is_fadump_capable; then
- 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 4c11bc9..1a24d29 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
Hi Xunlei,
On 08/30/17 at 10:12am, Xunlei Pang wrote:
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 4c11bc9..1a24d29 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)
In patch 6/8, you added rootfs device in case is_dump_to_rootfs so above checking is useless?
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
-- 1.8.3.1
Thanks Dave
On 08/30/2017 at 02:21 PM, Dave Young wrote:
Hi Xunlei,
On 08/30/17 at 10:12am, Xunlei Pang wrote:
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 4c11bc9..1a24d29 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)
In patch 6/8, you added rootfs device in case is_dump_to_rootfs so above checking is useless?
They are different, removing "root=X" is to skip systemd fstable mount generator. PATCH 6/8 is to notify dracut to mark root device as host devices(i.e. host_devs[]).
Regards, Xunlei
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
-- 1.8.3.1
Thanks Dave
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
Hi Xunlei,
On 08/30/17 at 10:12am, Xunlei Pang wrote:
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
Is the duplicate cmdline caused by using --hostonly-cmdline? If so it is better to add this in patchlog.
kdump_check_setup_iscsi() ( local _dev _dev=$1
-- 1.8.3.1
Thanks Dave
On 08/30/2017 at 02:25 PM, Dave Young wrote:
Hi Xunlei,
On 08/30/17 at 10:12am, Xunlei Pang wrote:
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
Is the duplicate cmdline caused by using --hostonly-cmdline? If so it is better to add this in patchlog.
Yes, will improve.
Regards, Xunlei
kdump_check_setup_iscsi() ( local _dev _dev=$1
-- 1.8.3.1
Thanks Dave
On 08/30/2017 at 10:12 AM, 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(simpler and better) 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
For better understanding, here is the improved changelog: Dracut has "--hostonly-cmdline" which can generate cmdlines(if any) regarding the dump target, it's an existing way for us to use to simplifa the code. E.g. We can remove generate_lvm_cmdlines() if we use "--hostonly-cmdline".
But "--hostonly-cmdline" has other issues(e.g. BZ1451717), it adds needless devices for kdump like root device. These issues can be solved with the help of dracut "--no-hostonly-default-device", we can have only one device being recognized (dump target) in most cases under kdump.
This patch series applies dracut's "--hostonly-cmdline" together with "--no-hostonly-default-device", and removes some old code accordingly.
Please "man dracut.cmdline" for "--hostonly-cmdline", "--no-hostonly-default-device" details.
Also see "--no-hostonly-default-device" patches: https://github.com/dracutdevs/dracut/pull/269
Has passed tests about LUKS, iscsi, lvm, nfs, etc.
dracut-module-setup.sh | 5 +++++ kdump-lib.sh | 25 +++++++++++---------- kdumpctl | 56 +++++++--------------------------------------- mkdumprd | 60 +++++++------------------------------------------- 4 files changed, 34 insertions(+), 112 deletions(-)