Whamcloud - gitweb
LU-17664 lnet: LNetPrimaryNID returns wrong NID 37/54537/2
authorChris Horn <chris.horn@hpe.com>
Fri, 22 Mar 2024 21:02:55 +0000 (15:02 -0600)
committerOleg Drokin <green@whamcloud.com>
Wed, 17 Apr 2024 05:24:25 +0000 (05:24 +0000)
This is a regression introduced by the b2_15 port of

Lustre-change: https://review.whamcloud.com/50159
Lustre-commit: fc7a0d6013b46ebc17cdfdccc04a5d1d92c6af24

This port assigned the return value to the wrong variable. As a
result, LNetPrimaryNID() will always return the same value that
was passed in as an argument. Fix the issue by assigning the
return value to the correct variable.

Test-Parameters: trivial
Fixes: 6cfc8e55a2 ("LU-14668 lnet: add 'lock_prim_nid" lnet module parameter")
Signed-off-by: Chris Horn <chris.horn@hpe.com>
Change-Id: I10e334d38e8c257239ae3fa82d0aea4f87d8ba69
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/54537
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Cyril Bordage <cbordage@whamcloud.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
lnet/lnet/peer.c

index 4eb7a44..4ba681a 100644 (file)
@@ -1501,14 +1501,14 @@ again:
 
        /* DD disabled, nothing to do */
        if (lnet_peer_discovery_disabled) {
-               nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
+               primary_nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
                spin_unlock(&lp->lp_lock);
                goto out_decref;
        }
 
        /* Peer already up to date, nothing to do */
        if (lnet_peer_is_uptodate_locked(lp)) {
-               nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
+               primary_nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
                spin_unlock(&lp->lp_lock);
                goto out_decref;
        }
@@ -1541,7 +1541,7 @@ again:
 
        if (!lock_prim_nid && !lnet_is_discovery_disabled(lp))
                goto again;
-       nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
+       primary_nid = lnet_nid_to_nid4(&lp->lp_primary_nid);
 out_decref:
        lnet_peer_ni_decref_locked(lpni);
 out_unlock: