fadump: fix default initrd backup and restore logic
In case of fadump, default initrd is rebuilt with dump capturing capability, as the same initrd is used for booting production kernel as well as capture kernel. The original initrd file is backed up with a checksum, to restore it as the default initrd when fadump is disabled. As the checksum file is not kernel version specific, switching between different kernel versions and kdump/fadump dump mode breaks the default initrd backup/restore logic. Fix this by having a kernel version specific checksum file. Also, if backing up initrd fails, retaining the checksum file isn't useful. Remove it. Signed-off-by: Hari Bathini <hbathini@linux.ibm.com> Reviewed-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
parent
f98bd5895e
commit
25411da966
6
kdumpctl
6
kdumpctl
@ -9,9 +9,9 @@ KDUMP_LOG_PATH="/var/log"
|
||||
MKDUMPRD="/sbin/mkdumprd -f"
|
||||
MKFADUMPRD="/sbin/mkfadumprd"
|
||||
DRACUT_MODULES_FILE="/usr/lib/dracut/modules.txt"
|
||||
INITRD_CHECKSUM_LOCATION="/boot/.fadump_initrd_checksum"
|
||||
DEFAULT_INITRD=""
|
||||
DEFAULT_INITRD_BAK=""
|
||||
INITRD_CHECKSUM_LOCATION=""
|
||||
KDUMP_INITRD=""
|
||||
TARGET_INITRD=""
|
||||
FADUMP_REGISTER_SYS_NODE="/sys/kernel/fadump_registered"
|
||||
@ -166,7 +166,8 @@ backup_default_initrd()
|
||||
sha1sum "$DEFAULT_INITRD" > "$INITRD_CHECKSUM_LOCATION"
|
||||
if ! cp "$DEFAULT_INITRD" "$DEFAULT_INITRD_BAK"; then
|
||||
dwarn "WARNING: failed to backup $DEFAULT_INITRD."
|
||||
rm -f "$DEFAULT_INITRD_BAK"
|
||||
rm -f -- "$INITRD_CHECKSUM_LOCATION"
|
||||
rm -f -- "$DEFAULT_INITRD_BAK"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
@ -317,6 +318,7 @@ setup_initrd()
|
||||
fi
|
||||
|
||||
DEFAULT_INITRD_BAK="$KDUMP_BOOTDIR/.$(basename "$DEFAULT_INITRD").default"
|
||||
INITRD_CHECKSUM_LOCATION="$DEFAULT_INITRD_BAK.checksum"
|
||||
if [[ $DEFAULT_DUMP_MODE == "fadump" ]]; then
|
||||
TARGET_INITRD="$DEFAULT_INITRD"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user