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 --- kdumpctl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 01433e2..3da5fff 100755 --- a/kdumpctl +++ b/kdumpctl @@ -605,6 +605,10 @@ check_fs_modified() is_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
@@ -617,9 +621,15 @@ is_system_modified() fi fi
- check_files_modified || return - check_fs_modified || return - check_drivers_modified + 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 + + return $conf_status }
# need_initrd_rebuild - check whether the initrd needs to be rebuild
LGTM
Acked-by: Tao Liu ltao@redhat.com
On Mon, Oct 30, 2023 at 2:52 PM Lichen Liu lichliu@redhat.com wrote:
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
kdumpctl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 01433e2..3da5fff 100755 --- a/kdumpctl +++ b/kdumpctl @@ -605,6 +605,10 @@ check_fs_modified() is_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
@@ -617,9 +621,15 @@ is_system_modified() fi fi
check_files_modified || return
check_fs_modified || return
check_drivers_modified
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
- return $conf_status
}
# need_initrd_rebuild - check whether the initrd needs to be rebuild
2.41.0
On Fri, Nov 10, 2023 at 09:54:42AM +0800, Tao Liu wrote:
LGTM
Acked-by: Tao Liu ltao@redhat.com
On Mon, Oct 30, 2023 at 2:52 PM Lichen Liu lichliu@redhat.com wrote:
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
kdumpctl | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/kdumpctl b/kdumpctl index 01433e2..3da5fff 100755 --- a/kdumpctl +++ b/kdumpctl @@ -605,6 +605,10 @@ check_fs_modified() is_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
@@ -617,9 +621,15 @@ is_system_modified() fi fi
check_files_modified || return
check_fs_modified || return
check_drivers_modified
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
- return $conf_status
}
# need_initrd_rebuild - check whether the initrd needs to be rebuild
2.41.0
Patch was merged, thanks to Lichen and Tao!