From: Chris Horn Date: Fri, 26 Mar 2021 16:28:18 +0000 (-0500) Subject: LU-14566 lnet: Skip discovery in LNetPrimaryNID if DD disabled X-Git-Tag: 2.14.52~108 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=16264da9e3c43a6368a25b6ded4113e8cfa57427 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. Test-Parameters: trivial HPE-bug-id: LUS-9887 Signed-off-by: Chris Horn Change-Id: I6d188e16422ad47a146d52bb24cdd1b77a30aa71 Reviewed-on: https://review.whamcloud.com/43141 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Serguei Smirnov Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lnet/lnet/peer.c b/lnet/lnet/peer.c index 20ae558..d70415e 100644 --- a/lnet/lnet/peer.c +++ b/lnet/lnet/peer.c @@ -1347,7 +1347,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; @@ -1368,7 +1374,11 @@ LNetPrimaryNID(lnet_nid_t nid) } 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; }