From 7141d044c8880815f308e61f612b710b7bc8a9a3 Mon Sep 17 00:00:00 2001 From: Lichen Liu Date: Tue, 1 Mar 2022 13:09:00 +0800 Subject: [PATCH] kdumpctl: sync the $TARGET_INITRD after rebuild There is a system-wide sync call at the end of mkdumprd, move it to kdumpctl after rebuild initrd and add another one for mkfadumprd. Sync only the $TARGET_INITRD to avoid a system-wide sync taking too long on a system with high disk activity. Also update the sync in kdumpctl:restore_default_initrd which will mv the $DEFAULT_INITRD_BAK to $DEFAULT_INITRD. Signed-off-by: Lichen Liu Reviewed-by: Philipp Rudo --- kdumpctl | 4 +++- mkdumprd | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kdumpctl b/kdumpctl index ac6ffeb..1869753 100755 --- a/kdumpctl +++ b/kdumpctl @@ -79,6 +79,7 @@ rebuild_fadump_initrd() return 1 fi + sync -f "$TARGET_INITRD" return 0 } @@ -100,6 +101,7 @@ rebuild_kdump_initrd() dwarn "Tips: If early kdump is enabled, also require rebuilding the system initramfs to make the changes take effect for early kdump." fi + sync -f "$TARGET_INITRD" return 0 } @@ -180,7 +182,7 @@ restore_default_initrd() rm -f $INITRD_CHECKSUM_LOCATION if mv "$DEFAULT_INITRD_BAK" "$DEFAULT_INITRD"; then derror "Restoring original initrd as fadump mode is disabled." - sync + sync -f "$DEFAULT_INITRD" fi fi fi diff --git a/mkdumprd b/mkdumprd index 593ec77..5996d50 100644 --- a/mkdumprd +++ b/mkdumprd @@ -458,7 +458,3 @@ if ! is_fadump_capable; then fi dracut "${dracut_args[@]}" "$@" - -_rc=$? -sync -exit $_rc