Whamcloud - gitweb
LU-7734 lnet: handle N NIs to 1 LND peer
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd.c
index 3d5f65b..c07d4d1 100644 (file)
@@ -376,7 +376,7 @@ kiblnd_destroy_peer (kib_peer_t *peer)
 }
 
 kib_peer_t *
 }
 
 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 */
 {
        /* the caller is responsible for accounting the additional reference
         * that this creates */
@@ -389,7 +389,14 @@ kiblnd_find_peer_locked (lnet_nid_t nid)
                peer = list_entry(tmp, kib_peer_t, ibp_list);
                LASSERT(!kiblnd_peer_idle(peer));
 
                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",
                        continue;
 
                CDEBUG(D_NET, "got peer [%p] -> %s (%d) version: %x\n",
@@ -1149,7 +1156,7 @@ kiblnd_query(lnet_ni_t *ni, lnet_nid_t nid, cfs_time_t *when)
 
        read_lock_irqsave(glock, flags);
 
 
        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;
 
        if (peer != NULL)
                last_alive = peer->ibp_last_alive;