From: Amir Shehata Date: Thu, 14 Sep 2017 22:49:38 +0000 (-0700) Subject: LU-9992 lnet: don't discover loopback interface X-Git-Tag: 2.10.54~13 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=de823879c43d43ac306d1ef731d66fa497ff015c;p=fs%2Flustre-release.git LU-9992 lnet: don't discover loopback interface 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 Change-Id: I821a74e9dbe35481a0168389b857f07397cee126 Reviewed-on: https://review.whamcloud.com/29007 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Sonia Sharma Reviewed-by: Olaf Weber Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index 7309d43..d8a1464 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -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 diff --git a/lnet/lnet/peer.c b/lnet/lnet/peer.c index 766ef83..cfdc3ef 100644 --- a/lnet/lnet/peer.c +++ b/lnet/lnet/peer.c @@ -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));