#define LNET_MATCHMD_NONE 0 /* Didn't match */
#define LNET_MATCHMD_OK 1 /* Matched OK */
-#define LNET_MATCHMD_DROP 2 /* Must be disarded */
+#define LNET_MATCHMD_DROP 2 /* Must be discarded */
static int
lnet_try_match_md (int index, int op_mask, lnet_process_id_t src,
return 0;
}
- CDEBUG(D_NET, "clearing portal %d lazy\n", portal);
+ if (the_lnet.ln_shutdown)
+ CWARN ("Active lazy portal %d on exit\n", portal);
+ else
+ CDEBUG (D_NET, "clearing portal %d lazy\n", portal);
/* grab all the blocked messages atomically */
list_add(&zombies, &ptl->ptl_msgq);
case LNET_MATCHMD_NONE:
rc = lnet_eager_recv_locked(msg);
- if (rc == 0) {
+ if (rc == 0 && !the_lnet.ln_shutdown) {
list_add_tail(&msg->msg_list,
&the_lnet.ln_portals[index].ptl_msgq);
LNET_UNLOCK();
return ENOENT; /* +ve: OK but no match */
-
}
}
msg = lnet_msg_alloc();
if (msg == NULL) {
CERROR("%s, src %s: Dropping %s (out of memory)\n",
- libcfs_nid2str(from_nid), libcfs_nid2str(src_nid)
- , lnet_msgtyp2str(type));
+ libcfs_nid2str(from_nid), libcfs_nid2str(src_nid),
+ lnet_msgtyp2str(type));
goto drop;
}
return -EHOSTUNREACH;
}
+int
+LNetSetAsync(lnet_process_id_t id, int nasync)
+{
+#ifdef __KERNEL__
+ return 0;
+#else
+ lnet_ni_t *ni;
+ lnet_remotenet_t *rnet;
+ struct list_head *tmp;
+ lnet_route_t *route;
+ lnet_nid_t *nids;
+ int nnids;
+ int maxnids = 256;
+ int rc = 0;
+ int rc2;
+
+ /* Target on a local network? */
+
+ ni = lnet_net2ni(LNET_NIDNET(id.nid));
+ if (ni != NULL) {
+ if (ni->ni_lnd->lnd_setasync != NULL)
+ rc = (ni->ni_lnd->lnd_setasync)(ni, id, nasync);
+ lnet_ni_decref(ni);
+ return rc;
+ }
+
+ /* Target on a remote network: apply to routers */
+ again:
+ LIBCFS_ALLOC(nids, maxnids * sizeof(*nids));
+ if (nids == NULL)
+ return -ENOMEM;
+ nnids = 0;
+
+ /* Snapshot all the router NIDs */
+ LNET_LOCK();
+ rnet = lnet_find_net_locked(LNET_NIDNET(id.nid));
+ if (rnet != NULL) {
+ list_for_each(tmp, &rnet->lrn_routes) {
+ if (nnids == maxnids) {
+ LNET_UNLOCK();
+ LIBCFS_FREE(nids, maxnids * sizeof(*nids));
+ maxnids *= 2;
+ goto again;
+ }
+
+ route = list_entry(tmp, lnet_route_t, lr_list);
+ nids[nnids++] = route->lr_gateway->lp_nid;
+ }
+ }
+ LNET_UNLOCK();
+
+ /* set async on all the routers */
+ while (nnids-- > 0) {
+ id.pid = LUSTRE_SRV_LNET_PID;
+ id.nid = nids[nnids];
+
+ ni = lnet_net2ni(LNET_NIDNET(id.nid));
+ if (ni == NULL)
+ continue;
+
+ if (ni->ni_lnd->lnd_setasync != NULL) {
+ rc2 = (ni->ni_lnd->lnd_setasync)(ni, id, nasync);
+ if (rc2 != 0)
+ rc = rc2;
+ }
+ lnet_ni_decref(ni);
+ }
+
+ LIBCFS_FREE(nids, maxnids * sizeof(*nids));
+ return rc;
+#endif
+}
+