@@ -1324,23 +1324,18 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
}
static struct lnet_route *
-lnet_find_route_locked(struct lnet_net *net, u32 remote_net,
+lnet_find_route_locked(struct lnet_remotenet *rnet,
struct lnet_route **prev_route,
struct lnet_peer_ni **gwni)
{
struct lnet_peer_ni *best_gw_ni = NULL;
struct lnet_route *best_route;
struct lnet_route *last_route;
- struct lnet_remotenet *rnet;
struct lnet_peer *lp_best;
struct lnet_route *route;
struct lnet_peer *lp;
int rc;
- rnet = lnet_find_rnet_locked(remote_net);
- if (!rnet)
- return NULL;
-
lp_best = NULL;
best_route = NULL;
last_route = NULL;
@@ -1832,7 +1827,7 @@ struct lnet_ni *
struct lnet_peer *lp;
struct lnet_peer_net *lpn;
struct lnet_peer_net *best_lpn = NULL;
- struct lnet_remotenet *rnet;
+ struct lnet_remotenet *rnet, *best_rnet = NULL;
struct lnet_route *best_route = NULL;
struct lnet_route *last_route = NULL;
struct lnet_peer_ni *lpni = NULL;
@@ -1867,13 +1862,16 @@ struct lnet_ni *
if (!rnet)
continue;
- if (!best_lpn)
+ if (!best_lpn) {
best_lpn = lpn;
+ best_rnet = rnet;
+ }
if (best_lpn->lpn_seq <= lpn->lpn_seq)
continue;
best_lpn = lpn;
+ best_rnet = rnet;
}
if (!best_lpn) {
@@ -1892,8 +1890,8 @@ struct lnet_ni *
return -EHOSTUNREACH;
}
- best_route = lnet_find_route_locked(NULL, best_lpn->lpn_net_id,
- &last_route, &gwni);
+ best_route = lnet_find_route_locked(best_rnet, &last_route,
+ &gwni);
if (!best_route) {
CERROR("no route to %s from %s\n",
libcfs_nid2str(dst_nid),