Whamcloud - gitweb
LU-17665 lnet: lock primary NID only on lustre-built peer 39/54539/2
authorSerguei Smirnov <ssmirnov@whamcloud.com>
Fri, 22 Mar 2024 22:31:55 +0000 (15:31 -0700)
committerOleg Drokin <green@whamcloud.com>
Mon, 8 Apr 2024 15:37:46 +0000 (15:37 +0000)
Primary NID locking is useful when client is connecting to a server
and peer representation of the server is provided to LNet by Lustre
via LNetAddPeer API - as interpreted from the mount command string
or llog.

When the server responds to a client, there's no need to lock
the client's primary NID.

Signed-off-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Change-Id: Ifd3098b93ad2e490659eb4adbf676cba4cbdc424
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54539
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/peer.c

index 8b4540a..92f8d44 100644 (file)
@@ -1420,11 +1420,6 @@ void LNetPrimaryNID(struct lnet_nid *nid)
         */
 again:
        spin_lock(&lp->lp_lock);
-       if (!(lp->lp_state & LNET_PEER_LOCK_PRIMARY) && lock_prim_nid) {
-               lp->lp_state |= LNET_PEER_LOCK_PRIMARY;
-               lp->lp_prim_lock_ts = ktime_get_ns();
-       }
-
        /* DD disabled, nothing to do */
        if (lnet_peer_discovery_disabled) {
                *nid = lp->lp_primary_nid;
@@ -1446,7 +1441,7 @@ again:
         * Messages to the peer will not go through until the discovery is
         * complete.
         */
-       if (lock_prim_nid)
+       if (lock_prim_nid && lp->lp_state & LNET_PEER_LOCK_PRIMARY)
                rc = lnet_discover_peer_locked(lpni, cpt, false);
        else
                rc = lnet_discover_peer_locked(lpni, cpt, true);