On Mon, Jan 11, 2021 at 10:42:41AM +0800, Liu Yinsi wrote:
[error] LKP: HOSTNAME vm-2p8g.2288hv5-2s44p-384g--b5-1573861, MAC , IP , kernel 5.9.0-5-riscv64 1, serial console /dev/ttyS0
[why] [ 93.815004] + network_ok [ 93.874456] ++ cat /sys/class/net/eth0//operstate [ 93.879278] + '[' up = up ']' [ 93.882356] + return 0 [ 93.941910] + export_ip_mac [ 93.956875] + cat /sys/class/net/eth0/operstate [ 93.960236] ++ route -n [ 93.968810] + route='Kernel IP routing table [ 93.988935] Destination GatewayGenmaskFlags Metric Ref Use Iface' [ 94.011625] + echo Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface [ 94.018548] + has_cmd ip [ 94.022832] + command -v ip [ 94.029742] ++ awk '{print $5; exit}' [ 94.036137] ++ ip route get 1.2.3.4 [ 94.045622] ++ /usr/bin/mawk '{print $5; exit}' [ 94.056504] RTNETLINK answers: Network is unreachable [ 94.061418] + export PUB_NIC= [ 94.064587] + PUB_NIC=
export_mac_ip: PUB_NIC=$(ip route get 1.2.3.4 | awk '{print $5; exit}') PUB_IP=$( ip route get 1.2.3.4 | awk '{print $7; exit}')
network_ok: [ "$(cat $i/operstate)" = 'up' ]&& return 0
[ -n $pub_nic ] || return 1
[ "$(cat $i/operstate)" = 'up'] && export_ip_mac && return 0 [ "$(cat $i/carrier 2>/dev/null)" = '1' ] && export_ip_mac && return 0
when cat /sys/class/net/eth0/operstate is up, network is ok, then it will not sleep and immediately execute export_ip_mac(), but actually route is not ready, it can't get mac and ip by search route, so use ping can ensure save enough time for route.
Signed-off-by: Liu Yinsi liuyinsi@163.com
lib/bootstrap.sh | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/bootstrap.sh b/lib/bootstrap.sh index b04ea3dd4..df25e99e0 100755 --- a/lib/bootstrap.sh +++ b/lib/bootstrap.sh @@ -87,13 +87,7 @@ net_devices_link()
network_ok() {
- local i
- for i in /sys/class/net/*/
- do
[ "${i#*/lo/}" != "$i" ] && continue
[ "$(cat $i/operstate)" = 'up' ] && return 0
[ "$(cat $i/carrier 2>/dev/null)" = '1' ] && return 0
- done
ping -c 3 $LKP_SERVER > /dev/null && return 0
is_clearlinux && { net_devices_link up
-- 2.23.0