}
kib_peer_t *
-kiblnd_find_peer_locked (lnet_nid_t nid)
+kiblnd_find_peer_locked(struct lnet_ni *ni, lnet_nid_t nid)
{
/* the caller is responsible for accounting the additional reference
* that this creates */
peer = list_entry(tmp, kib_peer_t, ibp_list);
LASSERT(!kiblnd_peer_idle(peer));
- if (peer->ibp_nid != nid)
+ /*
+ * Match a peer if its NID and the NID of the local NI it
+ * communicates over are the same. Otherwise don't match
+ * the peer, which will result in a new lnd peer being
+ * created.
+ */
+ if (peer->ibp_nid != nid ||
+ peer->ibp_ni->ni_nid != ni->ni_nid)
continue;
CDEBUG(D_NET, "got peer [%p] -> %s (%d) version: %x\n",
read_lock_irqsave(glock, flags);
- peer = kiblnd_find_peer_locked(nid);
+ peer = kiblnd_find_peer_locked(ni, nid);
if (peer != NULL)
last_alive = peer->ibp_last_alive;