@@ -878,6 +878,7 @@ int lnet_get_peer_ni_info(u32 peer_index, u64 *nid,
bool lnet_peer_is_uptodate(struct lnet_peer *lp);
bool lnet_peer_is_uptodate_locked(struct lnet_peer *lp);
bool lnet_is_discovery_disabled(struct lnet_peer *lp);
+bool lnet_is_discovery_disabled_locked(struct lnet_peer *lp);
bool lnet_peer_gw_discovery(struct lnet_peer *lp);
static inline bool
@@ -1141,6 +1141,7 @@ struct lnet_peer_ni *
bool
lnet_is_discovery_disabled_locked(struct lnet_peer *lp)
+__must_hold(&lp->lp_lock)
{
if (lnet_peer_discovery_disabled)
return true;
@@ -227,7 +227,7 @@ bool lnet_is_route_alive(struct lnet_route *route)
* aliveness information can only be obtained when discovery is
* enabled.
*/
- if (lnet_peer_discovery_disabled)
+ if (lnet_is_discovery_disabled(gw))
return route->lr_alive;
/* check the gateway's interfaces on the route rnet to make sure
@@ -316,11 +316,14 @@ bool lnet_is_route_alive(struct lnet_route *route)
spin_lock(&lp->lp_lock);
lp_state = lp->lp_state;
- spin_unlock(&lp->lp_lock);
/* only handle replies if discovery is disabled. */
- if (!lnet_peer_discovery_disabled)
+ if (!lnet_is_discovery_disabled_locked(lp)) {
+ spin_unlock(&lp->lp_lock);
return;
+ }
+
+ spin_unlock(&lp->lp_lock);
if (lp_state & LNET_PEER_PING_FAILED) {
CDEBUG(D_NET,