@@ -653,7 +653,7 @@ struct lnet_peer_ni *lnet_get_next_peer_ni_locked(struct lnet_peer *peer,
struct lnet_peer_ni *lnet_nid2peerni_ex(lnet_nid_t nid, int cpt);
struct lnet_peer_ni *lnet_find_peer_ni_locked(lnet_nid_t nid);
void lnet_peer_net_added(struct lnet_net *net);
-lnet_nid_t lnet_peer_primary_nid(lnet_nid_t nid);
+lnet_nid_t lnet_peer_primary_nid_locked(lnet_nid_t nid);
void lnet_peer_tables_cleanup(struct lnet_net *net);
void lnet_peer_uninit(void);
int lnet_peer_tables_create(void);
@@ -2338,8 +2338,6 @@
msg->msg_hdr.dest_pid = dest_pid;
msg->msg_hdr.payload_length = payload_length;
}
- /* Multi-Rail: Primary NID of source. */
- msg->msg_initiator = lnet_peer_primary_nid(src_nid);
lnet_net_lock(cpt);
lpni = lnet_nid2peerni_locked(from_nid, cpt);
@@ -2357,6 +2355,8 @@
msg->msg_rxpeer = lpni;
msg->msg_rxni = ni;
lnet_ni_addref_locked(ni, cpt);
+ /* Multi-Rail: Primary NID of source. */
+ msg->msg_initiator = lnet_peer_primary_nid_locked(src_nid);
if (lnet_isrouter(msg->msg_rxpeer)) {
lnet_peer_set_alive(msg->msg_rxpeer);
@@ -2658,8 +2658,7 @@ struct lnet_msg *
libcfs_nid2str(ni->ni_nid), libcfs_id2str(peer_id), getmd);
/* setup information for lnet_build_msg_event */
- msg->msg_initiator = lnet_peer_primary_nid(peer_id.nid);
- /* Cheaper: msg->msg_initiator = getmsg->msg_txpeer->lp_nid; */
+ msg->msg_initiator = getmsg->msg_txpeer->lpni_peer_net->lpn_peer->lp_primary_nid;
msg->msg_from = peer_id.nid;
msg->msg_type = LNET_MSG_GET; /* flag this msg as an "optimized" GET */
msg->msg_hdr.src_nid = peer_id.nid;
@@ -593,19 +593,16 @@ struct lnet_peer_ni *
}
lnet_nid_t
-lnet_peer_primary_nid(lnet_nid_t nid)
+lnet_peer_primary_nid_locked(lnet_nid_t nid)
{
struct lnet_peer_ni *lpni;
lnet_nid_t primary_nid = nid;
- int cpt;
- cpt = lnet_net_lock_current();
lpni = lnet_find_peer_ni_locked(nid);
if (lpni) {
primary_nid = lpni->lpni_peer_net->lpn_peer->lp_primary_nid;
lnet_peer_ni_decref_locked(lpni);
}
- lnet_net_unlock(cpt);
return primary_nid;
}