Whamcloud - gitweb
LU-13575 lnet: Ensure round robin selection of peer NIs
[fs/lustre-release.git] / lnet / lnet / lib-move.c
index b5fad9c..6117ccb 100644 (file)
@@ -1837,10 +1837,10 @@ lnet_handle_send(struct lnet_send_data *sd)
         * local ni and local net so that we pick the next ones
         * in Round Robin.
         */
-       best_lpni->lpni_seq++;
        best_lpni->lpni_peer_net->lpn_seq++;
-       best_ni->ni_seq++;
+       best_lpni->lpni_seq = best_lpni->lpni_peer_net->lpn_seq;
        best_ni->ni_net->net_seq++;
+       best_ni->ni_seq = best_ni->ni_net->net_seq;
 
        CDEBUG(D_NET, "%s NI seq info: [%d:%d:%d:%u] %s LPNI seq info [%d:%d:%d:%u]\n",
               libcfs_nidstr(&best_ni->ni_nid),
@@ -1950,9 +1950,9 @@ lnet_handle_send(struct lnet_send_data *sd)
                rspt = msg->msg_md->md_rspt_ptr;
                if (rspt) {
                        rspt->rspt_next_hop_nid =
-                               lnet_nid_to_nid4(&msg->msg_txpeer->lpni_nid);
+                               msg->msg_txpeer->lpni_nid;
                        CDEBUG(D_NET, "rspt_next_hop_nid = %s\n",
-                              libcfs_nid2str(rspt->rspt_next_hop_nid));
+                              libcfs_nidstr(&rspt->rspt_next_hop_nid));
                }
        }
 
@@ -3220,7 +3220,7 @@ lnet_finalize_expired_responses(void)
                        if (ktime_compare(now, rspt->rspt_deadline) >= 0 ||
                            the_lnet.ln_mt_state == LNET_MT_STATE_SHUTDOWN) {
                                struct lnet_peer_ni *lpni;
-                               lnet_nid_t nid;
+                               struct lnet_nid nid;
 
                                md = lnet_handle2md(&rspt->rspt_mdh);
                                if (!md) {
@@ -3278,7 +3278,7 @@ lnet_finalize_expired_responses(void)
 
                                CDEBUG(D_NET,
                                       "Response timeout: md = %p: nid = %s\n",
-                                      md, libcfs_nid2str(nid));
+                                      md, libcfs_nidstr(&nid));
 
                                /*
                                 * If there is a timeout on the response
@@ -3286,7 +3286,7 @@ lnet_finalize_expired_responses(void)
                                 * value so that we don't use it
                                 */
                                lnet_net_lock(0);
-                               lpni = lnet_find_peer_ni_locked(nid);
+                               lpni = lnet_peer_ni_find_locked(&nid);
                                if (lpni) {
                                        lnet_handle_remote_failure_locked(lpni);
                                        lnet_peer_ni_decref_locked(lpni);
@@ -4567,7 +4567,7 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid,
                        return -EPROTO;
                }
 
-               if (lnet_islocalnid(dest_nid)) {
+               if (lnet_islocalnid4(dest_nid)) {
                        /* dest is another local NI; sender should have used
                         * this node's NID on its own network */
                        CERROR("%s, src %s: Bad dest nid %s "
@@ -4659,10 +4659,10 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid,
                                      cpt);
        if (IS_ERR(lpni)) {
                lnet_net_unlock(cpt);
-               CERROR("%s, src %s: Dropping %s "
-                      "(error %ld looking up sender)\n",
+               rc = PTR_ERR(lpni);
+               CERROR("%s, src %s: Dropping %s (error %d looking up sender)\n",
                       libcfs_nid2str(from_nid), libcfs_nid2str(src_nid),
-                      lnet_msgtyp2str(type), PTR_ERR(lpni));
+                      lnet_msgtyp2str(type), rc);
                lnet_msg_free(msg);
                if (rc == -ESHUTDOWN)
                        /* We are shutting down.  Don't do anything more */