From cb5cd377e3510e01c972db8caf8bb42a505c3f90 Mon Sep 17 00:00:00 2001 From: Tao Liu Date: Mon, 21 Oct 2024 10:57:00 +1300 Subject: [PATCH] Return the correct exit code of rebuild initrd Related: RHEL-29941 Upstream: Fedora Conflict: None commit f6e00948aba7c31f722af79ed72c4020868dcad7 Author: Tao Liu Date: Fri Oct 18 21:45:03 2024 +1300 Return the correct exit code of rebuild initrd Resolves: https://issues.redhat.com/browse/RHEL-63047 The exit code of rebuild_initrd() should be either of rebuild_kdump/fadump_initrd(), rather than set_vmcore_creation_status(), otherwise it will cause a regression when rebuild initrd fails. Fixes: 88525ebf ("Introduce vmcore creation notification to kdump") Signed-off-by: Tao Liu Signed-off-by: Tao Liu --- ...-correct-exit-code-of-rebuild-initrd.patch | 44 +++++++++++++++++++ kdump-utils.spec | 4 ++ 2 files changed, 48 insertions(+) create mode 100644 0001-Return-the-correct-exit-code-of-rebuild-initrd.patch diff --git a/0001-Return-the-correct-exit-code-of-rebuild-initrd.patch b/0001-Return-the-correct-exit-code-of-rebuild-initrd.patch new file mode 100644 index 0000000..5e721ce --- /dev/null +++ b/0001-Return-the-correct-exit-code-of-rebuild-initrd.patch @@ -0,0 +1,44 @@ +From f6e00948aba7c31f722af79ed72c4020868dcad7 Mon Sep 17 00:00:00 2001 +From: Tao Liu +Date: Fri, 18 Oct 2024 21:45:03 +1300 +Subject: [PATCH] Return the correct exit code of rebuild initrd + +Resolves: https://issues.redhat.com/browse/RHEL-63047 + +The exit code of rebuild_initrd() should be either of +rebuild_kdump/fadump_initrd(), rather than set_vmcore_creation_status(), +otherwise it will cause a regression when rebuild initrd fails. + +Fixes: 88525ebf ("Introduce vmcore creation notification to kdump") + +Signed-off-by: Tao Liu +--- + kdumpctl | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/kdumpctl b/kdumpctl +index 82b7fb1..0140eeb 100755 +--- a/kdumpctl ++++ b/kdumpctl +@@ -173,6 +173,7 @@ rebuild_kdump_initrd() + + rebuild_initrd() + { ++ local _ret + dinfo "Rebuilding $TARGET_INITRD" + + if [[ ! -w $(dirname "$TARGET_INITRD") ]]; then +@@ -185,8 +186,10 @@ 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=' ' +-- +2.40.1 + diff --git a/kdump-utils.spec b/kdump-utils.spec index 82bef5f..f56698f 100644 --- a/kdump-utils.spec +++ b/kdump-utils.spec @@ -9,6 +9,10 @@ License: GPL-2.0-only URL: https://github.com/rhkdump/kdump-utils Source0: https://github.com/rhkdump/kdump-utils/archive/v%{version}/%{name}-%{version}.tar.gz +# Return the correct exit code of rebuild initrd +# Author: Tao Liu +Patch1: 0001-Return-the-correct-exit-code-of-rebuild-initrd.patch + %ifarch ppc64 ppc64le Requires(post): servicelog Recommends: keyutils