Whamcloud - gitweb
LU-14945 lnet: don't use hops to determine the route state
authorSerguei Smirnov <ssmirnov@whamcloud.com>
Mon, 16 Aug 2021 23:37:30 +0000 (16:37 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Fri, 9 Sep 2022 01:38:11 +0000 (01:38 +0000)
NodeA <-tcp1-> GW1 <-tcp2-> GW2 <-tcp3-> NodeB

Assuming GW1 knows how to reach tcp3 network and GW2 knows
how to reach tcp1 network, it should be possible to add routes
without specifying hop=2 on nodes A and B to reach tcp3 and tcp1
respectively and then be able to lnetctl ping between them.
Changes introduced by LU-13785 interpret default hops to be
equivalent to hop=1 set explicitly for the purpose of determining
route aliveness, which results in the routes created as described
above to be considered "down".

Fix it so that default hop setting doesn't prevent
the multi-hop scenario from working.

Lustre-change: https://review.whamcloud.com/44674
Lustre-commit: 3f2844dc9333c86452c37bd7b4519729b1351371

Test-Parameters: trivial
Fixes: 2e07619477 ("LU-13785 lnet: Use lr_hops for avoid_asym_router_failure")
Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Change-Id: I341ccdfe156434b0cb306359acc91a9193b44f7b
Reviewed-on: https://review.whamcloud.com/48337
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lnet/lnet/router.c

index 9357dd0..47d1c9e 100644 (file)
@@ -327,7 +327,7 @@ bool lnet_is_route_alive(struct lnet_route *route)
         * routes the next-hop will not have the remote net.
         */
        if (avoid_asym_router_failure &&
-           (route->lr_hops == 1 || route->lr_hops == LNET_UNDEFINED_HOPS)) {
+           (route->lr_hops == 1 || route->lr_single_hop)) {
                rlpn = lnet_peer_get_net_locked(gw, route->lr_net);
                if (!rlpn)
                        return false;
@@ -481,8 +481,7 @@ lnet_router_discovery_ping_reply(struct lnet_peer *lp)
 
                route->lr_single_hop = single_hop;
                if (avoid_asym_router_failure &&
-                   (route->lr_hops == 1 ||
-                    route->lr_hops == LNET_UNDEFINED_HOPS))
+                   (route->lr_hops == 1 || route->lr_single_hop))
                        lnet_set_route_aliveness(route, net_up);
                else
                        lnet_set_route_aliveness(route, true);
@@ -785,6 +784,14 @@ lnet_add_route(__u32 net, __u32 hops, lnet_nid_t gateway,
        lnet_peer_ni_decref_locked(lpni);
        lnet_net_unlock(LNET_LOCK_EX);
 
+       /* If avoid_asym_router_failure is enabled and hop count is not
+        * set to 1 for a route that is actually single-hop, then the
+        * feature will fail to prevent the router from being selected
+        * if it is missing a NI on the remote network due to misconfiguration.
+        */
+       if (avoid_asym_router_failure && hops == LNET_UNDEFINED_HOPS)
+               CWARN("Use hops = 1 for a single-hop route when avoid_asym_router_failure feature is enabled\n");
+
        rc = 0;
 
        if (!add_route) {