Skip to content

Commit

Permalink
Revert "Introduce vmcore creation notification to kdump"
Browse files Browse the repository at this point in the history
This patch will revert the following 2 patches:

    88525eb ("Introduce vmcore creation notification to kdump")
    3544953 ("Return the correct exit code of rebuild initrd")

For the preparation of reimplementation of vmcore creation notification.

Signed-off-by: Tao Liu <ltao@redhat.com>
  • Loading branch information
liutgnu committed Nov 29, 2024
1 parent 13e9264 commit 36845f4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 140 deletions.
11 changes: 0 additions & 11 deletions dracut/99kdumpbase/kdump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,22 +312,11 @@ do_final_action() {
}

do_dump() {
if [ -d /vmcorestatus ]; then
_vmcore_creation_status="/vmcorestatus/$VMCORE_CREATION_STATUS"
else
_vmcore_creation_status="/sysroot/$VMCORE_CREATION_STATUS"
fi

set_vmcore_creation_status 'clear' "$_vmcore_creation_status"

eval "$DUMP_INSTRUCTION"
_ret=$?

if [ $_ret -ne 0 ]; then
set_vmcore_creation_status 'fail' "$_vmcore_creation_status"
derror "saving vmcore failed"
else
set_vmcore_creation_status 'success' "$_vmcore_creation_status"
fi

return $_ret
Expand Down
4 changes: 0 additions & 4 deletions gen-kdump-sysconfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ KDUMP_IMG="vmlinuz"
#What is the images extension. Relocatable kernels don't have one
KDUMP_IMG_EXT=""
# Enable vmcore creation notification by default, disable by setting
# VMCORE_CREATION_NOTIFICATION=""
VMCORE_CREATION_NOTIFICATION="yes"
# Logging is controlled by following variables in the first kernel:
# - @var KDUMP_STDLOGLVL - logging level to standard error (console output)
# - @var KDUMP_SYSLOGLVL - logging level to syslog (by logger command)
Expand Down
33 changes: 0 additions & 33 deletions kdump-lib-initramfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ KDUMP_CONFIG_FILE="/etc/kdump.conf"
FENCE_KDUMP_CONFIG_FILE="/etc/sysconfig/fence_kdump"
FENCE_KDUMP_SEND="/usr/libexec/fence_kdump_send"
LVM_CONF="/etc/lvm/lvm.conf"
VMCORE_CREATION_STATUS="/var/crash/vmcore-creation.status"

# Read kdump config in well formated style
kdump_read_conf()
Expand Down Expand Up @@ -178,35 +177,3 @@ kdump_get_ip_route_field()
{
echo "$1" | sed -n -e "s/^.*\<$2\>\s\+\(\S\+\).*$/\1/p"
}

# $1: success/fail/clear
# $2: status_file
set_vmcore_creation_status()
{
_status=$1
_status_file=$2
_dir=$(dirname "$_status_file")

[[ -d "$_dir" ]] || mkdir -p "$_dir"

_mnt_op=$(get_mount_info OPTIONS target "$_dir" -f)
case $_mnt_op in
ro*)
dinfo "remounting the vmcore status target in rw mode."
mount -o remount,rw "$(findmnt -n -o TARGET --target $_dir)"
;;
esac

case "$_status" in
success | fail)
dinfo "saving vmcore status file to $_status_file"
echo "$_status $(date +%s)" > "$_status_file"
;;
clear)
rm -f "$_status_file"
;;
*)
return
esac
sync -f "$_dir"
}
72 changes: 4 additions & 68 deletions kdumpctl
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ rebuild_kdump_initrd()

rebuild_initrd()
{
local _ret
dinfo "Rebuilding $TARGET_INITRD"

if [[ ! -w $(dirname "$TARGET_INITRD") ]]; then
Expand All @@ -186,10 +185,6 @@ rebuild_initrd()
else
rebuild_kdump_initrd
fi
_ret=$?

set_vmcore_creation_status 'clear' "$VMCORE_CREATION_STATUS"
return $_ret
}

#$1: the files to be checked with IFS=' '
Expand Down Expand Up @@ -1064,7 +1059,6 @@ start()
start_dump || return

dinfo "Starting kdump: [OK]"
check_vmcore_creation_status
return 0
}

Expand Down Expand Up @@ -1680,63 +1674,6 @@ _should_reset_crashkernel() {
[[ $(kdump_get_conf_val auto_reset_crashkernel) != no ]] && systemctl is-enabled kdump &> /dev/null
}

check_vmcore_creation_status()
{
local _status _timestamp _status_date

[[ ${VMCORE_CREATION_NOTIFICATION,,} == "yes" ]] || return

if [[ ! -s $VMCORE_CREATION_STATUS ]]; then
dwarn "Notice: No vmcore creation test performed!"
return
fi

read -r _status _timestamp < "$VMCORE_CREATION_STATUS"
_status_date="$(date -d "@$_timestamp")"

if [[ "$_status" == "success" ]]; then
dinfo "Notice: Last successful vmcore creation on $_status_date"
else
dwarn "Notice: Last NOT successful vmcore creation on $_status_date"
fi
}

kdump_test()
{
local _dir

if ! is_kernel_loaded "$DEFAULT_DUMP_MODE"; then
derror "Kdump needs be operational before test."
exit 1
fi

_dir=$(dirname "$VMCORE_CREATION_STATUS")
if ! [[ -d "$_dir" ]]; then
derror "Vmcore status dir $_dir not exist."
exit 1
fi

if ! lsblk $(get_mount_info SOURCE target "$_dir") > /dev/null; then
derror "$VMCORE_CREATION_STATUS must on local drive"
exit 1
fi

if [[ ! "$1" == "--force" ]]; then
read -p "DANGER!!! Will perform a kdump test by crashing the system, proceed? (y/N): " input
case $input in
[Yy] )
dinfo "Start kdump test..."
;;
* )
dinfo "Operation cancelled."
exit 0
;;
esac
fi
set_vmcore_creation_status 'clear' "$VMCORE_CREATION_STATUS"
echo c > /proc/sysrq-trigger
}

main()
{
# Determine if the dump mode is kdump or fadump
Expand Down Expand Up @@ -1768,7 +1705,6 @@ main()
EXIT_CODE=3
;;
esac
check_vmcore_creation_status
exit $EXIT_CODE
;;
reload)
Expand Down Expand Up @@ -1803,6 +1739,10 @@ main()
shift
reset_crashkernel "$@"
;;
test)
shift
kdump_test "$@"
;;
_reset-crashkernel-after-update)
if _should_reset_crashkernel; then
reset_crashkernel_after_update
Expand All @@ -1813,10 +1753,6 @@ main()
reset_crashkernel_for_installed_kernel "$2"
fi
;;
test)
shift
kdump_test "$@"
;;
*)
dinfo $"Usage: $0 {estimate|start|stop|status|restart|reload|rebuild|reset-crashkernel|propagate|showmem|test}"
exit 1
Expand Down
10 changes: 0 additions & 10 deletions kdumpctl.8
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@ Note: The memory requirements for kdump varies heavily depending on the
used hardware and system configuration. Thus the recommended
crashkernel might not work for your specific setup. Please test if
kdump works after resetting the crashkernel value.
.TP
.I test [--force]
Test the kdump by actually trigger the system crash & dump, and check if a
vmcore can really be generated successfully based on current config and
environment. After system reboot back to normal, check the test result
by "kdumpctl status".

If the optional parameter [--force] is provided, there will be no interact
before triggering the system crash. Dangerous though, this option is meant
for automation testing.

.SH "SEE ALSO"
.BR kdump.conf (5),
Expand Down
16 changes: 2 additions & 14 deletions mkdumprd
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,9 @@ has_dracut_module()
# caller should ensure $1 is valid and mounted in 1st kernel
to_mount()
{
local _target=$1 _fstype=$2 _options=$3 _new_mntpoint=$4
local _sed_cmd _pdev
local _target=$1 _fstype=$2 _options=$3 _sed_cmd _new_mntpoint _pdev

_new_mntpoint="${_new_mntpoint:-$(get_kdump_mntpoint_from_target "$_target")}"
_new_mntpoint=$(get_kdump_mntpoint_from_target "$_target")
_fstype="${_fstype:-$(get_fs_type_from_target "$_target")}"
_options="${_options:-$(get_mntopt_from_target "$_target")}"
_options="${_options:-defaults}"
Expand Down Expand Up @@ -428,17 +427,6 @@ if ! is_fadump_capable; then
fi
fi

status_target=$(get_target_from_path $(dirname "$VMCORE_CREATION_STATUS"))

if [[ $(get_root_fs_device) != "$status_target" ]]; then
new_mntpoint=$(echo /vmcorestatus/$(get_mntpoint_from_target "$status_target") \
| tr -s "/")
add_mount "$status_target" "" "" "$new_mntpoint"
elif ! is_fadump_capable && \
! [[ ${dracut_args[@]} == *"$(kdump_get_persistent_dev $status_target)"* ]]; then
add_mount "$status_target"
fi

# Use kdump managed dracut profile.
[[ $kdump_dracut_confdir ]] || kdump_dracut_confdir=/lib/kdump/dracut.conf.d
if [[ "$(dracut --help)" == *--add-confdir* ]] && [[ -d "$kdump_dracut_confdir" ]]; then
Expand Down

0 comments on commit 36845f4

Please sign in to comment.