X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lnet%2Flnet%2Flib-move.c;h=75a0650d34a97d4e671d68b33bcfd27e0f19ac6e;hp=e3bad23b05f698a0a511edefc4c6f3e864c1eeb3;hb=1a7720934dfb3105afd2f025c953bea2167d4e5d;hpb=f843facff59226d3788d855d1d6948523ab8d944 diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index e3bad23..75a0650 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -42,8 +42,6 @@ #include #include -extern unsigned int lnet_current_net_count; - static int local_nid_dist_zero = 1; module_param(local_nid_dist_zero, int, 0444); MODULE_PARM_DESC(local_nid_dist_zero, "Reserved"); @@ -1910,8 +1908,11 @@ lnet_handle_spec_local_nmr_dst(struct lnet_send_data *sd) * Local Destination * MR Peer * - * Run the selection algorithm on the peer NIs unless we're sending - * a response, in this case just send to the destination + * Don't run the selection algorithm on the peer NIs. By specifying the + * local NID, we're also saying that we should always use the destination NID + * provided. This handles the case where we should be using the same + * destination NID for the all the messages which belong to the same RPC + * request. */ static int lnet_handle_spec_local_mr_dst(struct lnet_send_data *sd) @@ -1924,17 +1925,6 @@ lnet_handle_spec_local_mr_dst(struct lnet_send_data *sd) return -EINVAL; } - /* - * only run the selection algorithm to pick the peer_ni if we're - * sending a GET or a PUT. Responses are sent to the same - * destination NID provided. - */ - if (!(sd->sd_send_case & SND_RESP)) { - sd->sd_best_lpni = - lnet_find_best_lpni_on_net(sd, sd->sd_peer, - sd->sd_best_ni->ni_net->net_id); - } - if (sd->sd_best_lpni && sd->sd_best_lpni->lpni_nid == the_lnet.ln_loni->ni_nid) return lnet_handle_lo_send(sd); @@ -2009,15 +1999,21 @@ lnet_initiate_peer_discovery(struct lnet_peer_ni *lpni, } /* The peer may have changed. */ peer = lpni->lpni_peer_net->lpn_peer; + spin_lock(&peer->lp_lock); + if (lnet_peer_is_uptodate_locked(peer)) { + spin_unlock(&peer->lp_lock); + lnet_peer_ni_decref_locked(lpni); + return 0; + } /* queue message and return */ msg->msg_rtr_nid_param = rtr_nid; msg->msg_sending = 0; msg->msg_txpeer = NULL; - spin_lock(&peer->lp_lock); list_add_tail(&msg->msg_list, &peer->lp_dc_pendq); + primary_nid = peer->lp_primary_nid; spin_unlock(&peer->lp_lock); + lnet_peer_ni_decref_locked(lpni); - primary_nid = peer->lp_primary_nid; CDEBUG(D_NET, "msg %p delayed. %s pending discovery\n", msg, libcfs_nid2str(primary_nid)); @@ -2671,11 +2667,10 @@ again: msg->msg_src_nid_param = src_nid; /* - * Now that we have a peer_ni, check if we want to discover - * the peer. Traffic to the LNET_RESERVED_PORTAL should not - * trigger discovery. + * If necessary, perform discovery on the peer that owns this peer_ni. + * Note, this can result in the ownership of this peer_ni changing + * to another peer object. */ - peer = lpni->lpni_peer_net->lpn_peer; rc = lnet_initiate_peer_discovery(lpni, msg, rtr_nid, cpt); if (rc) { lnet_peer_ni_decref_locked(lpni); @@ -2684,6 +2679,8 @@ again: } lnet_peer_ni_decref_locked(lpni); + peer = lpni->lpni_peer_net->lpn_peer; + /* * Identify the different send cases */ @@ -3542,9 +3539,13 @@ lnet_monitor_thread(void *arg) min((unsigned int) alive_router_check_interval / lnet_current_net_count, lnet_transaction_timeout / 2)); - wait_event_interruptible_timeout(the_lnet.ln_mt_waitq, - false, - cfs_time_seconds(interval)); + wait_for_completion_interruptible_timeout( + &the_lnet.ln_mt_wait_complete, + cfs_time_seconds(interval)); + /* Must re-init the completion before testing anything, + * including ln_mt_state. + */ + reinit_completion(&the_lnet.ln_mt_wait_complete); } /* Shutting down */ @@ -3809,7 +3810,7 @@ void lnet_monitor_thr_stop(void) lnet_net_unlock(LNET_LOCK_EX); /* tell the monitor thread that we're shutting down */ - wake_up(&the_lnet.ln_mt_waitq); + complete(&the_lnet.ln_mt_wait_complete); /* block until monitor thread signals that it's done */ down(&the_lnet.ln_mt_signal); @@ -3820,8 +3821,6 @@ void lnet_monitor_thr_stop(void) lnet_clean_local_ni_recoveryq(); lnet_clean_peer_ni_recoveryq(); lnet_clean_resendqs(); - - return; } void @@ -5094,9 +5093,9 @@ LNetDist(lnet_nid_t dstnid, lnet_nid_t *srcnidp, __u32 *orderp) * current net namespace. * If not, assign order above 0xffff0000, * to make this ni not a priority. */ - if (!net_eq(ni->ni_net_ns, current->nsproxy->net_ns)) - order += 0xffff0000; - + if (current->nsproxy && + !net_eq(ni->ni_net_ns, current->nsproxy->net_ns)) + order += 0xffff0000; if (srcnidp != NULL) *srcnidp = ni->ni_nid; if (orderp != NULL)