From 908ce58a765cb90692b840f8902414836d378206 Mon Sep 17 00:00:00 2001 From: Olaf Weber Date: Fri, 27 Jan 2017 16:14:34 +0100 Subject: [PATCH] LU-9119 lnet: loopback NID in lnet_select_pathway() 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 Change-Id: Ifa25abf508214ae363a2f1bb04ffeab1891a2564 Reviewed-on: https://review.whamcloud.com/26692 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin --- lnet/lnet/lib-move.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index ec3051c..9dc6565 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -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; /* -- 1.8.3.1