Whamcloud - gitweb
LU-9119 lnet: loopback NID in lnet_select_pathway() 92/26692/4
authorOlaf Weber <olaf@sgi.com>
Fri, 27 Jan 2017 15:14:34 +0000 (16:14 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 5 May 2017 00:43:54 +0000 (00:43 +0000)
In lnet_select_pathway() sending to the loopback NID is handled
as a special case, because there are no credits involved. (The
loopback NID doesn't use credits, and therefore does not have
any credits. If a message goes through the credit-managing code
it therefore ends up waiting indefinitely for credits to become
available.)

The check whether we're sending over the loopback NID must be
done after we've completed choosing the NI to send over. In its
present location it only handles the case where the loopback
NID was explicitly passed in as the source NID.

(Lustre does not exercise this code path during normal operation,
the bug was encountered while testing code for the peer discovery
feature.)

Test-Parameters: trivial
Signed-off-by: Olaf Weber <olaf@sgi.com>
Change-Id: Ifa25abf508214ae363a2f1bb04ffeab1891a2564
Reviewed-on: https://review.whamcloud.com/26692
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/lib-move.c

index ec3051c..9dc6565 100644 (file)
@@ -1555,20 +1555,6 @@ again:
                }
        }
 
-       if (best_ni == the_lnet.ln_loni) {
-               /* No send credit hassles with LOLND */
-               lnet_ni_addref_locked(best_ni, cpt);
-               msg->msg_hdr.dest_nid = cpu_to_le64(best_ni->ni_nid);
-               if (!msg->msg_routing)
-                       msg->msg_hdr.src_nid = cpu_to_le64(best_ni->ni_nid);
-               msg->msg_target.nid = best_ni->ni_nid;
-               lnet_msg_commit(msg, cpt);
-               msg->msg_txni = best_ni;
-               lnet_net_unlock(cpt);
-
-               return LNET_CREDIT_OK;
-       }
-
        /*
         * if we already found a best_ni because src_nid is specified and
         * best_lpni because we are replying to a message then just send
@@ -1810,6 +1796,21 @@ pick_peer:
 
 
 send:
+       /* Shortcut for loopback. */
+       if (best_ni == the_lnet.ln_loni) {
+               /* No send credit hassles with LOLND */
+               lnet_ni_addref_locked(best_ni, cpt);
+               msg->msg_hdr.dest_nid = cpu_to_le64(best_ni->ni_nid);
+               if (!msg->msg_routing)
+                       msg->msg_hdr.src_nid = cpu_to_le64(best_ni->ni_nid);
+               msg->msg_target.nid = best_ni->ni_nid;
+               lnet_msg_commit(msg, cpt);
+               msg->msg_txni = best_ni;
+               lnet_net_unlock(cpt);
+
+               return LNET_CREDIT_OK;
+       }
+
        routing = routing || routing2;
 
        /*