From 419022d2b8d236036fd59468bb189a9d5fba5786 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Fri, 26 Mar 2021 11:28:18 -0500 Subject: [PATCH] LU-14566 lnet: Skip discovery in LNetPrimaryNID if DD disabled If discovery is disabled locally then the discovery thread will not modify any peer objects as a result of the discovery process. Thus, the primary NID of any peer we're asked to discover will not change as a result of discovery. Therefore, we do not need to actually perform discovery in LNetPrimaryNID() if discovery is disabled locally. Since this routine can result in long client mount times when a Lustre server is down we should avoid this unnecessary discovery. Lustre-change: https://review.whamcloud.com/43141 Lustre-commit: 16264da9e3c43a6368a25b6ded4113e8cfa57427 Test-Parameters: trivial HPE-bug-id: LUS-9887 Signed-off-by: Chris Horn Change-Id: I6d188e16422ad47a146d52bb24cdd1b77a30aa71 Reviewed-on: https://review.whamcloud.com/43141 Reviewed-by: Serguei Smirnov Reviewed-by: James Simmons Reviewed-on: https://review.whamcloud.com/44224 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lnet/lnet/peer.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lnet/lnet/peer.c b/lnet/lnet/peer.c index a6943e7..b376fe1 100644 --- a/lnet/lnet/peer.c +++ b/lnet/lnet/peer.c @@ -1193,7 +1193,13 @@ LNetPrimaryNID(lnet_nid_t nid) } lp = lpni->lpni_peer_net->lpn_peer; - while (!lnet_peer_is_uptodate(lp)) { + /* If discovery is disabled locally then we needn't bother running + * discovery here because discovery will not modify whatever + * primary NID is currently set for this peer. If the specified peer is + * down then this discovery can introduce long delays into the mount + * process, so skip it if it isn't necessary. + */ + while (!lnet_peer_discovery_disabled && !lnet_peer_is_uptodate(lp)) { spin_lock(&lp->lp_lock); /* force a full discovery cycle */ lp->lp_state |= LNET_PEER_FORCE_PING | LNET_PEER_FORCE_PUSH; @@ -1204,7 +1210,11 @@ LNetPrimaryNID(lnet_nid_t nid) goto out_decref; lp = lpni->lpni_peer_net->lpn_peer; - /* Only try once if discovery is disabled */ + /* If we find that the peer has discovery disabled then we will + * not modify whatever primary NID is currently set for this + * peer. Thus, we can break out of this loop even if the peer + * is not fully up to date. + */ if (lnet_is_discovery_disabled(lp)) break; } -- 1.8.3.1