Whamcloud - gitweb
LU-16606 lnet: lnet_parse_route uses wrong loop var 73/50173/3
authorChris Horn <chris.horn@hpe.com>
Wed, 1 Mar 2023 19:27:21 +0000 (13:27 -0600)
committerOleg Drokin <green@whamcloud.com>
Mon, 13 Mar 2023 06:05:19 +0000 (06:05 +0000)
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 <chris.horn@hpe.com>
Change-Id: Idbcc5e211fc8fd49831ba572805b60be511d0ffd
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50173
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: jsimmons <jsimmons@infradead.org>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/config.c
lustre/tests/sanity-lnet.sh

index 81eaa39..08609e3 100644 (file)
@@ -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;
index e8e332a..e68d79d 100755 (executable)
@@ -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 <<EOF > $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 <<EOF >> $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 <<EOF >> $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