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 <lichliu@redhat.com>
Reviewed-by: Philipp Rudo <prudo@redhat.com>
This commit is contained in:
Lichen Liu 2022-03-01 13:09:00 +08:00 committed by Coiby Xu
parent 6d4062a936
commit 7141d044c8
2 changed files with 3 additions and 5 deletions

View File

@ -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

View File

@ -458,7 +458,3 @@ if ! is_fadump_capable; then
fi
dracut "${dracut_args[@]}" "$@"
_rc=$?
sync
exit $_rc