From a0f7f2ecdf165a4a2a60743bddc45723c8488ef7 Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Tue, 18 Apr 2023 15:26:17 +0800 Subject: [PATCH] Show how much time kdump has waited for the network to be ready Related: bz2151504 Upstream: Fedora Conflict: None commit 12d9eff9dcd3bcd5890821c8d8a219b94412aca8 Author: Coiby Xu Date: Tue Mar 28 16:33:34 2023 +0800 Show how much time kdump has waited for the network to be ready Relates: https://bugzilla.redhat.com/show_bug.cgi?id=2151504 Currently, when the network isn't ready, kdump would repeatedly print the same info, [ 29.537230] kdump[671]: Bad kdump network destination: 192.123.1.21 [ 30.559418] kdump[679]: Bad kdump network destination: 192.123.1.21 [ 31.580189] kdump[687]: Bad kdump network destination: 192.123.1.21 This is not user-friendly and users may think kdump has got stuck. So also show much time has waited for the network to be ready, [ 29.546258] kdump[673]: Waiting for network to be ready (50s / 10min) ... [ 32.608967] kdump[697]: Waiting for network to be ready (56s / 10min) Note kdump_get_ip_route no longer prints an error message and it's up to the caller to determine the log level and print relevant messages. And kdump_collect_netif_usage aborts when kdump_get_ip_route fails. Reported-by: Martin Pitt Signed-off-by: Coiby Xu Reviewed-by: Philipp Rudo Signed-off-by: Coiby Xu --- dracut-kdump.sh | 2 ++ dracut-module-setup.sh | 7 ++++++- kdump-lib-initramfs.sh | 1 - 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/dracut-kdump.sh b/dracut-kdump.sh index 06e2c02..80acc93 100755 --- a/dracut-kdump.sh +++ b/dracut-kdump.sh @@ -491,6 +491,8 @@ wait_online_network() if _route=$(kdump_get_ip_route "$1" 2> /dev/null); then printf "%s" "$_route" return + else + dwarn "Waiting for network to be ready (${_loop}s / 10min)" fi done diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 6eac2ae..b74447f 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -540,7 +540,12 @@ kdump_collect_netif_usage() { local _destaddr _srcaddr _route _netdev _destaddr=$(kdump_get_remote_ip "$1") - _route=$(kdump_get_ip_route "$_destaddr") + + if ! _route=$(kdump_get_ip_route "$_destaddr"); then + derror "Bad kdump network destination: $_destaddr" + exit 1 + fi + _srcaddr=$(kdump_get_ip_route_field "$_route" "src") _netdev=$(kdump_get_ip_route_field "$_route" "dev") diff --git a/kdump-lib-initramfs.sh b/kdump-lib-initramfs.sh index a8ec3fe..41dc751 100755 --- a/kdump-lib-initramfs.sh +++ b/kdump-lib-initramfs.sh @@ -166,7 +166,6 @@ is_lvm2_thinp_device() kdump_get_ip_route() { if ! _route=$(/sbin/ip -o route get to "$1" 2>&1); then - derror "Bad kdump network destination: $1" exit 1 fi echo "$_route"