From 0a414b1077a2f9dbc02539683453ae7dd729d5a7 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Wed, 1 Mar 2023 13:27:21 -0600 Subject: [PATCH] LU-16606 lnet: lnet_parse_route uses wrong loop var When looping over the gateways list, we're referencing the wrong loop variable to get the gateway nid (ltb instead of ltb2). Test-Parameters: trivial testlist=sanity-lnet Fixes: 3b76020810 ("LU-6142 lnet: use list_first_entry() in lnet/lnet subdirectory.") Signed-off-by: Chris Horn Change-Id: Idbcc5e211fc8fd49831ba572805b60be511d0ffd Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50173 Tested-by: jenkins Tested-by: Maloo Reviewed-by: jsimmons Reviewed-by: Serguei Smirnov Reviewed-by: Oleg Drokin --- lnet/lnet/config.c | 2 +- lustre/tests/sanity-lnet.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 1 deletion(-) diff --git a/lnet/lnet/config.c b/lnet/lnet/config.c index 81eaa39..08609e3 100644 --- a/lnet/lnet/config.c +++ b/lnet/lnet/config.c @@ -1178,7 +1178,7 @@ lnet_parse_route(char *str, int *im_a_router) LASSERT(net != LNET_NET_ANY); list_for_each_entry(ltb2, &gateways, ltb_list) { - LASSERT(libcfs_strnid(&nid, ltb->ltb_text) == 0); + LASSERT(libcfs_strnid(&nid, ltb2->ltb_text) == 0); if (lnet_islocalnid(&nid)) { *im_a_router = 1; diff --git a/lustre/tests/sanity-lnet.sh b/lustre/tests/sanity-lnet.sh index e8e332a..e68d79d 100755 --- a/lustre/tests/sanity-lnet.sh +++ b/lustre/tests/sanity-lnet.sh @@ -3306,6 +3306,72 @@ test_254() { } run_test 254 "Message delayed beyond deadline should be dropped (multi-rail)" +test_255() { + [[ ${NETTYPE} == tcp* ]] || skip "Need tcp NETTYPE" + + reinit_dlc || return $? + + cleanup_lnet || return $? + + local ip=$(ip -o -4 a s ${INTERFACES[0]} | + awk '{print $4}' | sed 's/\/.*//') + local net=$(awk -F. '{print $1"."$2"."$3}'<<<"${ip}") + local host=$(awk -F. '{print $4}'<<<"${ip}") + + if (((host + 5) > 254)); then + host=1 + fi + + local range="[$((host + 1))-$((host + 5))]" + + local routes_str="o2ib ${net}.${range}@${NETTYPE}" + local network_str="${NETTYPE}(${INTERFACES[0]})" + + load_lnet "networks=\"${network_str}\" routes=\"${routes_str}\"" || + error "Failed to load LNet" + + $LCTL net up || + error "Failed to load LNet with networks=\"${network_str}\" routes=\"${routes_str}\"" + + cat < $TMP/sanity-lnet-$testnum-expected.yaml +net: + - net type: ${NETTYPE} + local NI(s): + - interfaces: + 0: ${INTERFACES[0]} +EOF + append_net_tunables tcp + + echo "route:" >> $TMP/sanity-lnet-$testnum-expected.yaml + for i in $(seq $((host + 1)) $((host +5))); do + cat <> $TMP/sanity-lnet-$testnum-expected.yaml + - net: o2ib + gateway: ${net}.${i}@${NETTYPE} + hop: -1 + priority: 0 + health_sensitivity: 1 +EOF + done + + echo "peer:" >> $TMP/sanity-lnet-$testnum-expected.yaml + for i in $(seq $((host + 1)) $((host +5))); do + cat <> $TMP/sanity-lnet-$testnum-expected.yaml + - primary nid: ${net}.${i}@${NETTYPE} + Multi-Rail: False + peer ni: + - nid: ${net}.${i}@${NETTYPE} +EOF + done + + append_global_yaml + + $LNETCTL export --backup > $TMP/sanity-lnet-$testnum-actual.yaml || + error "export failed $?" + + validate_gateway_nids +} +run_test 255 "Use lnet routes param with pdsh syntax" + test_300() { # LU-13274 local header -- 1.8.3.1