Hi Philipp,
Philipp Rudo <prudo(a)redhat.com> 于2022年1月20日周四 03:15写道:
Hi Kairui,
On Sun, 9 Jan 2022 19:43:21 +0800
Kairui Song <ryncsn(a)gmail.com> wrote:
> From: Kairui Song <kasong(a)tencent.com>
>
> Make log saving the last step of kdump.sh, so it can catch more info, for
> example, the output of post.d hooks will be covered by the log now.
>
> Signed-off-by: Kairui Song <kasong(a)tencent.com>
> ---
> dracut-kdump.sh | 27 +++++++++++++++------------
> 1 file changed, 15 insertions(+), 12 deletions(-)
>
> diff --git a/dracut-kdump.sh b/dracut-kdump.sh
> index b69bc98..b221eab 100755
> --- a/dracut-kdump.sh
> +++ b/dracut-kdump.sh
> @@ -15,6 +15,8 @@ fi
>
> KDUMP_PATH="/var/crash"
> KDUMP_LOG_FILE="/run/initramfs/kexec-dmesg.log"
> +KDUMP_LOG_DEST=""
> +KDUMP_LOG_OP=""
> CORE_COLLECTOR=""
> DEFAULT_CORE_COLLECTOR="makedumpfile -l --message-level 7 -d 31"
> DMESG_COLLECTOR="/sbin/vmcore-dmesg"
> @@ -119,6 +121,10 @@ save_log()
> journalctl -ab >> $KDUMP_LOG_FILE
> fi
> chmod 600 $KDUMP_LOG_FILE
> +
> + dinfo "saving the $KDUMP_LOG_FILE to $KDUMP_LOG_DEST/"
> +
> + eval "$KDUMP_LOG_OP"
> }
with your change save_log now gets also called after dump_raw for which
KDUMP_LOG_{OP,DEST} aren't set. This shouldn't cause an error. But it
still prints a misleading info message and unnecessarily saves the log
to KDUMP_LOG_FILE. So I think you should add a
[ -n %KDUMP_LOG_OP ] || return
Thanks for the review, I will update the patch.