Whamcloud - gitweb
LU-10123 lnet: ensure peer put back on dc request queue
[fs/lustre-release.git] / lnet / lnet / peer.c
index f24294b..4b5702d 100644 (file)
@@ -1989,13 +1989,16 @@ void lnet_peer_push_event(struct lnet_event *ev)
 
 out:
        /*
-        * Queue the peer for discovery, and wake the discovery thread
-        * if the peer was already queued, because its status changed.
+        * Queue the peer for discovery if not done, force it on the request
+        * queue and wake the discovery thread if the peer was already queued,
+        * because its status changed.
         */
        spin_unlock(&lp->lp_lock);
        lnet_net_lock(LNET_LOCK_EX);
-       if (lnet_peer_queue_for_discovery(lp))
+       if (!lnet_peer_is_uptodate(lp) && lnet_peer_queue_for_discovery(lp)) {
+               list_move(&lp->lp_dc_list, &the_lnet.ln_dc_request);
                wake_up(&the_lnet.ln_dc_waitq);
+       }
        /* Drop refcount from lookup */
        lnet_peer_decref_locked(lp);
        lnet_net_unlock(LNET_LOCK_EX);
@@ -2355,7 +2358,10 @@ static void lnet_discovery_event_handler(struct lnet_event *event)
                lnet_ping_buffer_decref(pbuf);
                lnet_peer_decref_locked(lp);
        }
-       if (rc == LNET_REDISCOVER_PEER) {
+
+       /* put peer back at end of request queue, if discovery not already
+        * done */
+       if (rc == LNET_REDISCOVER_PEER && !lnet_peer_is_uptodate(lp)) {
                list_move_tail(&lp->lp_dc_list, &the_lnet.ln_dc_request);
                wake_up(&the_lnet.ln_dc_waitq);
        }