Whamcloud - gitweb
LU-7734 lnet: cpt locking
[fs/lustre-release.git] / lnet / lnet / lib-move.c
index 311335a..e9dd9b3 100644 (file)
@@ -1405,6 +1405,11 @@ lnet_select_pathway(lnet_nid_t src_nid, lnet_nid_t dst_nid,
         * then we proceed, if there is, then we restart the operation.
         */
        cpt = lnet_net_lock_current();
+
+       md_cpt = lnet_cpt_of_md(msg->msg_md);
+       if (md_cpt == CFS_CPT_ANY)
+               md_cpt = cpt;
+
 again:
        best_ni = NULL;
        best_lpni = NULL;
@@ -1422,12 +1427,6 @@ again:
                return -ESHUTDOWN;
        }
 
-       if (msg->msg_md != NULL)
-               /* get the cpt of the MD, used during NUMA based selection */
-               md_cpt = lnet_cpt_of_cookie(msg->msg_md->md_lh.lh_cookie);
-       else
-               md_cpt = CFS_CPT_ANY;
-
        peer = lnet_find_or_create_peer_locked(dst_nid, cpt);
        if (IS_ERR(peer)) {
                lnet_net_unlock(cpt);
@@ -1466,7 +1465,8 @@ again:
 
        if (msg->msg_type == LNET_MSG_REPLY ||
            msg->msg_type == LNET_MSG_ACK ||
-           !peer->lp_multi_rail) {
+           !peer->lp_multi_rail ||
+           best_ni) {
                /*
                 * for replies we want to respond on the same peer_ni we
                 * received the message on if possible. If not, then pick
@@ -1475,6 +1475,12 @@ again:
                 * if the peer is non-multi-rail then you want to send to
                 * the dst_nid provided as well.
                 *
+                * If the best_ni has already been determined, IE the
+                * src_nid has been specified, then use the
+                * destination_nid provided as well, since we're
+                * continuing a series of related messages for the same
+                * RPC.
+                *
                 * It is expected to find the lpni using dst_nid, since we
                 * created it earlier.
                 */