Whamcloud - gitweb
LU-12942 lnet: Optimize check for routing feature flag 79/36679/2
authorChris Horn <hornc@cray.com>
Wed, 11 Sep 2019 20:27:30 +0000 (15:27 -0500)
committerOleg Drokin <green@whamcloud.com>
Fri, 6 Dec 2019 01:15:18 +0000 (01:15 +0000)
Check the routing feature flag outside of the loop.

Cray-bug-id: LUS-7862
Test-Parameters: trivial
Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: I636305532d4bd5b8157a9df1b98af0da3bba867f
Reviewed-on: https://review.whamcloud.com/36679
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Alexandr Boyko <c17825@cray.com>
Reviewed-by: Alexey Lyashkov <c17817@cray.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
lnet/lnet/router.c

index 2014e67..c7368ca 100644 (file)
@@ -341,12 +341,14 @@ lnet_router_discovery_ping_reply(struct lnet_peer *lp)
 
        spin_unlock(&lp->lp_lock);
 
-       if (lp_state & LNET_PEER_PING_FAILED) {
-               CDEBUG(D_NET,
-                      "Ping failed with %d. Set routes down for gw %s\n",
-                      lp->lp_ping_error, libcfs_nid2str(lp->lp_primary_nid));
-               /* If the ping failed then mark the routes served by this
-                * peer down
+       if (lp_state & LNET_PEER_PING_FAILED ||
+           pbuf->pb_info.pi_features & LNET_PING_FEAT_RTE_DISABLED) {
+               CDEBUG(D_NET, "Set routes down for gw %s because %s %d\n",
+                      libcfs_nid2str(lp->lp_primary_nid),
+                      lp_state & LNET_PEER_PING_FAILED ? "ping failed" :
+                      "route feature is disabled", lp->lp_ping_error);
+               /* If the ping failed or the peer has routing disabled then
+                * mark the routes served by this peer down
                 */
                list_for_each_entry(route, &lp->lp_routes, lr_gwlist)
                        lnet_set_route_aliveness(route, false);
@@ -376,13 +378,6 @@ lnet_router_discovery_ping_reply(struct lnet_peer *lp)
                            route->lr_gateway->lp_primary_nid)
                                continue;
 
-                       /* gateway has the routing feature disabled */
-                       if (pbuf->pb_info.pi_features &
-                             LNET_PING_FEAT_RTE_DISABLED) {
-                               lnet_set_route_aliveness(route, false);
-                               continue;
-                       }
-
                        llpn = lnet_peer_get_net_locked(lp, route->lr_lnet);
                        if (!llpn) {
                                lnet_set_route_aliveness(route, false);