if (!msg->msg_peerrtrcredit) {
/* lpni_lock protects the credit manipulation */
spin_lock(&lpni->lpni_lock);
- /* lp_lock protects the lp_rtrq */
- spin_lock(&lp->lp_lock);
msg->msg_peerrtrcredit = 1;
lpni->lpni_rtrcredits--;
lpni->lpni_minrtrcredits = lpni->lpni_rtrcredits;
if (lpni->lpni_rtrcredits < 0) {
+ spin_unlock(&lpni->lpni_lock);
/* must have checked eager_recv before here */
LASSERT(msg->msg_rx_ready_delay);
msg->msg_rx_delayed = 1;
+ /* lp_lock protects the lp_rtrq */
+ spin_lock(&lp->lp_lock);
list_add_tail(&msg->msg_list, &lp->lp_rtrq);
spin_unlock(&lp->lp_lock);
- spin_unlock(&lpni->lpni_lock);
return LNET_CREDIT_WAIT;
}
- spin_unlock(&lp->lp_lock);
spin_unlock(&lpni->lpni_lock);
}
LASSERT(rxpeerni->lpni_peer_net);
LASSERT(rxpeerni->lpni_peer_net->lpn_peer);
- lp = rxpeerni->lpni_peer_net->lpn_peer;
-
/* give back peer router credits */
msg->msg_peerrtrcredit = 0;
spin_lock(&rxpeerni->lpni_lock);
- spin_lock(&lp->lp_lock);
-
rxpeerni->lpni_rtrcredits++;
+ spin_unlock(&rxpeerni->lpni_lock);
+
+ lp = rxpeerni->lpni_peer_net->lpn_peer;
+ spin_lock(&lp->lp_lock);
/* drop all messages which are queued to be routed on that
* peer. */
LIST_HEAD(drop);
list_splice_init(&lp->lp_rtrq, &drop);
spin_unlock(&lp->lp_lock);
- spin_unlock(&rxpeerni->lpni_lock);
lnet_drop_routed_msgs_locked(&drop, msg->msg_rx_cpt);
} else if (!list_empty(&lp->lp_rtrq)) {
int msg2_cpt;
list_del(&msg2->msg_list);
msg2_cpt = msg2->msg_rx_cpt;
spin_unlock(&lp->lp_lock);
- spin_unlock(&rxpeerni->lpni_lock);
/*
* messages on the lp_rtrq can be from any NID in
* the peer, which means they might have different
}
} else {
spin_unlock(&lp->lp_lock);
- spin_unlock(&rxpeerni->lpni_lock);
}
}
if (rxni != NULL) {
send_case |= REMOTE_DST;
/*
- * if this is a non-MR peer or if we're recovering a peer ni then
- * let's consider this an NMR case so we can hit the destination
- * NID.
+ * Deal with the peer as NMR in the following cases:
+ * 1. the peer is NMR
+ * 2. We're trying to recover a specific peer NI
+ * 3. I'm a router sending to the final destination
+ * In this case the source of the message would've
+ * already selected the final destination so my job
+ * is to honor the selection.
*/
- if (!lnet_peer_is_multi_rail(peer) || msg->msg_recovery)
+ if (!lnet_peer_is_multi_rail(peer) || msg->msg_recovery ||
+ (msg->msg_routing && (send_case & LOCAL_DST)))
send_case |= NMR_DST;
else
send_case |= MR_DST;