Whamcloud - gitweb
LU-14008 o2iblnd: cleanup
[fs/lustre-release.git] / lnet / lnet / lib-move.c
index 3259946..9551627 100644 (file)
@@ -2189,13 +2189,19 @@ lnet_handle_find_routed_path(struct lnet_send_data *sd,
        }
 
        if (!route_found) {
-               if (sd->sd_msg->msg_routing) {
+               if (sd->sd_msg->msg_routing || src_nid != LNET_NID_ANY) {
                        /* If I'm routing this message then I need to find the
                         * next hop based on the destination NID
+                        *
+                        * We also find next hop based on the destination NID
+                        * if the source NI was specified
                         */
                        best_rnet = lnet_find_rnet_locked(LNET_NIDNET(sd->sd_dst_nid));
                        if (!best_rnet) {
-                               CERROR("Unable to route message to %s - Route table may be misconfigured\n",
+                               CERROR("Unable to send message from %s to %s - Route table may be misconfigured\n",
+                                      src_nid != LNET_NID_ANY ?
+                                               libcfs_nid2str(src_nid) :
+                                               "any local NI",
                                       libcfs_nid2str(sd->sd_dst_nid));
                                return -EHOSTUNREACH;
                        }
@@ -2977,15 +2983,19 @@ again:
        /*
         * Identify the different send cases
         */
-       if (src_nid == LNET_NID_ANY)
+       if (src_nid == LNET_NID_ANY) {
                send_case |= SRC_ANY;
-       else
+               if (lnet_get_net_locked(LNET_NIDNET(dst_nid)))
+                       send_case |= LOCAL_DST;
+               else
+                       send_case |= REMOTE_DST;
+       } else {
                send_case |= SRC_SPEC;
-
-       if (lnet_get_net_locked(LNET_NIDNET(dst_nid)))
-               send_case |= LOCAL_DST;
-       else
-               send_case |= REMOTE_DST;
+               if (LNET_NIDNET(src_nid) == LNET_NIDNET(dst_nid))
+                       send_case |= LOCAL_DST;
+               else
+                       send_case |= REMOTE_DST;
+       }
 
        final_hop = false;
        if (msg->msg_routing && (send_case & LOCAL_DST))
@@ -4472,6 +4482,7 @@ lnet_msgtyp2str (int type)
                return ("<UNKNOWN>");
        }
 }
+EXPORT_SYMBOL(lnet_msgtyp2str);
 
 int
 lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid4,