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 <chris.horn@hpe.com>
Change-Id: I6d188e16422ad47a146d52bb24cdd1b77a30aa71
Reviewed-on: https://review.whamcloud.com/43141
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
}
lp = lpni->lpni_peer_net->lpn_peer;
}
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;
spin_lock(&lp->lp_lock);
/* force a full discovery cycle */
lp->lp_state |= LNET_PEER_FORCE_PING | LNET_PEER_FORCE_PUSH;
}
lp = lpni->lpni_peer_net->lpn_peer;
}
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;
}
if (lnet_is_discovery_disabled(lp))
break;
}