kdumpctl: Only returns immediately after an error occurs in check_*_modified

Resolves: https://issues.redhat.com/browse/RHEL-10484
Upstream: Fedora
Conflict: Missing upstream patch d4e8772("kdumpctl: make do_estimate more
robust")

commit 741861164e24247e995d47a8284b7493cb73b769
Author: Lichen Liu <lichliu@redhat.com>
Date:   Mon Oct 30 14:51:59 2023 +0800

    kdumpctl: Only returns immediately after an error occurs in check_*_modified

    Currently is_system_modified will return immediately when check_*_modified
    return a non-zero value, and the remaining checks will not be executed.

    For example, if there is a fs-related error exists, and someone changes the
    kdump.conf, check_files_modified will return 1 and is_system_modified will
    return 1 immediately. This will cause kdumpctl to skip check_fs/drivers_modified,
    kdump.service will rebuild the initrd and start successfully, however, any
    errors should prevent kdump.service from starting.

    This patch will cause check_*_modifed to continue running until an error occurs
    or all execution ends.

    Signed-off-by: Lichen Liu <lichliu@redhat.com>
    Acked-by: Tao Liu <ltao@redhat.com>

Signed-off-by: Lichen Liu <lichliu@redhat.com>
This commit is contained in:
Lichen Liu 2023-11-17 14:15:25 +08:00
parent 209852b908
commit 4ab1df8671
1 changed files with 12 additions and 18 deletions

View File

@ -532,28 +532,22 @@ check_fs_modified()
check_system_modified()
{
local ret
local CONF_ERROR=2
local CONF_MODIFY=1
local CONF_NO_MODIFY=0
local conf_status=$CONF_NO_MODIFY
[[ -f $TARGET_INITRD ]] || return 1
check_files_modified
ret=$?
if [[ $ret -ne 0 ]]; then
return $ret
fi
for _func in check_files_modified check_fs_modified check_drivers_modified; do
$_func
ret=$?
# return immediately if an error occurred.
[[ $ret -eq "$CONF_ERROR" ]] && return "$ret"
[[ $ret -eq "$CONF_MODIFY" ]] && { conf_status="$CONF_MODIFY"; }
done
check_fs_modified
ret=$?
if [[ $ret -ne 0 ]]; then
return $ret
fi
check_drivers_modified
ret=$?
if [[ $ret -ne 0 ]]; then
return $ret
fi
return 0
return $conf_status
}
check_rebuild()