Whamcloud - gitweb
LU-9992 lnet: don't discover loopback interface 07/29007/2
authorAmir Shehata <amir.shehata@intel.com>
Thu, 14 Sep 2017 22:49:38 +0000 (15:49 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 30 Sep 2017 04:41:18 +0000 (04:41 +0000)
Whenever we send messages destined to the loopback interface
it should always go over the loopback interface. To achieve that
there is no real need to initiate discovery on the loopback.
This will result in a non-mr peer created for the loopback,
Which makes sense because if we are to send messages to
ourselves we do not want to use the different interfaces
rather just keep sending over the lolnd. In effect this
is a special case where we want to behave as a non-mr
node.

When sending a message destined for the loopback interface
there is no need to go through the selection process, it
is sufficient to shortcut all the MR logic and send directly
over the lolnd.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Change-Id: I821a74e9dbe35481a0168389b857f07397cee126
Reviewed-on: https://review.whamcloud.com/29007
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Sonia Sharma <sonia.sharma@intel.com>
Reviewed-by: Olaf Weber <olaf.weber@hpe.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/lib-move.c
lnet/lnet/peer.c

index 7309d43..d8a1464 100644 (file)
@@ -1567,6 +1567,18 @@ again:
                lnet_net_unlock(cpt);
                return PTR_ERR(lpni);
        }
+
+       /*
+        * If we're being asked to send to the loopback interface, there
+        * is no need to go through any selection. We can just shortcut
+        * the entire process and send over lolnd
+        */
+       if (LNET_NETTYP(LNET_NIDNET(dst_nid)) == LOLND) {
+               lnet_peer_ni_decref_locked(lpni);
+               best_ni = the_lnet.ln_loni;
+               goto send;
+       }
+
        /*
         * Now that we have a peer_ni, check if we want to discover
         * the peer. Traffic to the LNET_RESERVED_PORTAL should not
index 766ef83..cfdc3ef 100644 (file)
@@ -247,6 +247,15 @@ lnet_peer_alloc(lnet_nid_t nid)
        init_waitqueue_head(&lp->lp_dc_waitq);
        spin_lock_init(&lp->lp_lock);
        lp->lp_primary_nid = nid;
+       /*
+        * Turn off discovery for loopback peer. If you're creating a peer
+        * for the loopback interface then that was initiated when we
+        * attempted to send a message over the loopback. There is no need
+        * to ever use a different interface when sending messages to
+        * myself.
+        */
+       if (LNET_NETTYP(LNET_NIDNET(nid)) == LOLND)
+               lp->lp_state = LNET_PEER_NO_DISCOVERY;
        lp->lp_cpt = lnet_nid_cpt_hash(nid, LNET_CPT_NUMBER);
 
        CDEBUG(D_NET, "%p nid %s\n", lp, libcfs_nid2str(lp->lp_primary_nid));