"Assume routers are down and ping them before use");
static int avoid_asym_router_failure = 0;
-CFS_MODULE_PARM(avoid_asym_router_failure, "i", int, 0444,
+CFS_MODULE_PARM(avoid_asym_router_failure, "i", int, 0644,
"Avoid asymmetrical failures: reserved, use at your own risk");
static int dead_router_check_interval = 0;
-CFS_MODULE_PARM(dead_router_check_interval, "i", int, 0444,
+CFS_MODULE_PARM(dead_router_check_interval, "i", int, 0644,
"Seconds between dead router health checks (<= 0 to disable)");
static int live_router_check_interval = 0;
-CFS_MODULE_PARM(live_router_check_interval, "i", int, 0444,
+CFS_MODULE_PARM(live_router_check_interval, "i", int, 0644,
"Seconds between live router health checks (<= 0 to disable)");
static int router_ping_timeout = 50;
-CFS_MODULE_PARM(router_ping_timeout, "i", int, 0444,
+CFS_MODULE_PARM(router_ping_timeout, "i", int, 0644,
"Seconds to wait for the reply to a router health query");
int
lp->lp_notify = 1;
lp->lp_notifylnd |= notifylnd;
if (lp->lp_alive)
- lp->lp_ping_version = LNET_PROTO_PING_UNKNOWN; /* reset */
+ lp->lp_ping_feats = LNET_PING_FEAT_INVAL; /* reset */
- CDEBUG(D_NET, "set %s %d\n", libcfs_nid2str(lp->lp_nid), alive);
+ CDEBUG(D_NET, "set %s %d\n", libcfs_nid2str(lp->lp_nid), alive);
}
void
cfs_list_add(&route->lr_list, e);
cfs_list_add(&route->lr_gwlist, &route->lr_gateway->lp_routes);
- the_lnet.ln_remote_nets_version++;
- lnet_rtr_addref_locked(route->lr_gateway);
+ the_lnet.ln_remote_nets_version++;
+ lnet_rtr_addref_locked(route->lr_gateway);
}
int
LIBCFS_FREE(rnet, sizeof(*rnet));
if (rc == -EHOSTUNREACH) { /* gateway is not on a local net */
- return 0; /* ignore the route entry */
+ return 0; /* ignore the route entry */
} else {
CERROR("Error %d creating route %s %d %s\n", rc,
libcfs_net2str(net), hops,
if (!add_route)
LIBCFS_FREE(route, sizeof(*route));
- if (rnet != rnet2)
- LIBCFS_FREE(rnet, sizeof(*rnet));
+ if (rnet != rnet2)
+ LIBCFS_FREE(rnet, sizeof(*rnet));
- return 0;
+ return 0;
}
int
}
int
-lnet_del_route (__u32 net, lnet_nid_t gw_nid)
+lnet_del_route(__u32 net, lnet_nid_t gw_nid)
{
struct lnet_peer *gateway;
lnet_remotenet_t *rnet;
void
lnet_swap_pinginfo(lnet_ping_info_t *info)
{
- int i;
- lnet_ni_status_t *stat;
+ int i;
+ lnet_ni_status_t *stat;
__swab32s(&info->pi_magic);
- __swab32s(&info->pi_version);
+ __swab32s(&info->pi_features);
__swab32s(&info->pi_pid);
__swab32s(&info->pi_nnis);
for (i = 0; i < info->pi_nnis && i < LNET_MAX_RTR_NIS; i++) {
if (info->pi_magic != LNET_PROTO_PING_MAGIC) {
CDEBUG(D_NET, "%s: Unexpected magic %08x\n",
libcfs_nid2str(gw->lp_nid), info->pi_magic);
- gw->lp_ping_version = LNET_PROTO_PING_UNKNOWN;
+ gw->lp_ping_feats = LNET_PING_FEAT_INVAL;
return;
}
- gw->lp_ping_version = info->pi_version;
- if (gw->lp_ping_version == LNET_PROTO_PING_VERSION_1)
- return; /* v1 doesn't carry NI status info */
-
- if (gw->lp_ping_version != LNET_PROTO_PING_VERSION) {
- CDEBUG(D_NET, "%s: Unexpected version 0x%x\n",
- libcfs_nid2str(gw->lp_nid), gw->lp_ping_version);
- gw->lp_ping_version = LNET_PROTO_PING_UNKNOWN;
- return;
+ gw->lp_ping_feats = info->pi_features;
+ if ((gw->lp_ping_feats & LNET_PING_FEAT_MASK) == 0) {
+ CDEBUG(D_NET, "%s: Unexpected features 0x%x\n",
+ libcfs_nid2str(gw->lp_nid), gw->lp_ping_feats);
+ return; /* nothing I can understand */
}
+ if ((gw->lp_ping_feats & LNET_PING_FEAT_NI_STATUS) == 0)
+ return; /* can't carry NI status info */
+
cfs_list_for_each_entry(rtr, &gw->lp_routes, lr_gwlist) {
int ptl_status = LNET_NI_STATUS_INVALID;
int down = 0;
if (nid == LNET_NID_ANY) {
CDEBUG(D_NET, "%s: unexpected LNET_NID_ANY\n",
libcfs_nid2str(gw->lp_nid));
- gw->lp_ping_version = LNET_PROTO_PING_UNKNOWN;
+ gw->lp_ping_feats = LNET_PING_FEAT_INVAL;
return;
}
CDEBUG(D_NET, "%s: Unexpected status 0x%x\n",
libcfs_nid2str(gw->lp_nid), stat->ns_status);
- gw->lp_ping_version = LNET_PROTO_PING_UNKNOWN;
+ gw->lp_ping_feats = LNET_PING_FEAT_INVAL;
return;
}
if (event->unlinked) {
LNetInvalidateHandle(&rcd->rcd_mdh);
return;
- }
+ }
LASSERT(event->type == LNET_EVENT_SEND ||
event->type == LNET_EVENT_REPLY);
mdh = rcd->rcd_mdh;
if (rtr->lp_ping_deadline == 0) {
- rtr->lp_ping_deadline = \
+ rtr->lp_ping_deadline =
cfs_time_shift(router_ping_timeout);
}
LNetMDUnlink(rcd->rcd_mdh);
lnet_net_lock(LNET_LOCK_EX);
- }
+ }
cfs_list_splice_init(&head, &the_lnet.ln_rcd_zombie);
while (!cfs_list_empty(&the_lnet.ln_rcd_zombie)) {
cfs_list_for_each_entry_safe(rcd, tmp, &the_lnet.ln_rcd_zombie,
rcd_list) {
- if (!LNetHandleIsInvalid(rcd->rcd_mdh))
+ if (LNetHandleIsInvalid(rcd->rcd_mdh))
cfs_list_move(&rcd->rcd_list, &head);
- }
+ }
wait_unlink = wait_unlink &&
!cfs_list_empty(&the_lnet.ln_rcd_zombie);
}
if (!wait_unlink)
- break;
+ return;
i++;
CDEBUG(((i & (-i)) == i) ? D_WARNING : D_NET,
lnet_net_lock(LNET_LOCK_EX);
}
+
+ lnet_net_unlock(LNET_LOCK_EX);
}
cfs_list_for_each(entry, &the_lnet.ln_routers) {
rtr = cfs_list_entry(entry, lnet_peer_t, lp_rtr_list);
- cpt2 = lnet_cpt_of_nid(rtr->lp_nid);
+ cpt2 = lnet_cpt_of_nid_locked(rtr->lp_nid);
if (cpt != cpt2) {
lnet_net_unlock(cpt);
cpt = cpt2;
the_lnet.ln_rc_state = LNET_RC_STATE_SHUTDOWN;
cfs_up(&the_lnet.ln_rc_signal);
- /* The unlink event callback will signal final completion */
- return 0;
+ /* The unlink event callback will signal final completion */
+ return 0;
}
void
lnet_rtrpools_free(void)
{
lnet_rtrbufpool_t *rtrp;
- int i;
+ int i;
if (the_lnet.ln_rtrpools == NULL) /* uninitialized or freed */
return;
lnet_net_lock(cpt);
+ if (the_lnet.ln_shutdown) {
+ lnet_net_unlock(cpt);
+ return -ESHUTDOWN;
+ }
+
lp = lnet_find_peer_locked(the_lnet.ln_peer_tables[cpt], nid);
if (lp == NULL) {
/* nid not found */