Whamcloud - gitweb
LU-10391 lnet: switch LNetIsPeerLocal() to take 16-byte addr 21/43621/11
authorMr NeilBrown <neilb@suse.de>
Fri, 10 Jul 2020 05:58:29 +0000 (15:58 +1000)
committerOleg Drokin <green@whamcloud.com>
Mon, 30 May 2022 19:03:14 +0000 (19:03 +0000)
LNetIsPeerLocal() now takes a 'struct lnet_nid'

Test-Parameters: trivial
Test-Parameters: serverversion=2.12 serverdistro=el7.9 testlist=runtests
Test-Parameters: clientversion=2.12 testlist=runtests
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Id72a92cda510de6864c82d88912c582745cc9727
Reviewed-on: https://review.whamcloud.com/43621
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Amir Shehata <ashehata@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/include/lnet/api.h
lnet/lnet/api-ni.c
lustre/include/lustre_net.h
lustre/mgc/mgc_request.c
lustre/target/tgt_handler.c
lustre/target/tgt_lastrcvd.c

index 63b19b2..ca04543 100644 (file)
@@ -77,7 +77,7 @@ int LNetNIFini(void);
 int LNetGetId(unsigned int index, struct lnet_processid *id);
 int LNetDist(struct lnet_nid *nid, struct lnet_nid *srcnid, __u32 *order);
 void LNetPrimaryNID(struct lnet_nid *nid);
-bool LNetIsPeerLocal(lnet_nid_t nid);
+bool LNetIsPeerLocal(struct lnet_nid *nid);
 
 /** @} lnet_addr */
 
index 4a43942..a4a1c78 100644 (file)
@@ -4566,7 +4566,7 @@ EXPORT_SYMBOL(LNetDebugPeer);
  * \retval true                If peer NID is on the local node.
  * \retval false       If peer NID is not on the local node.
  */
-bool LNetIsPeerLocal(lnet_nid_t nid)
+bool LNetIsPeerLocal(struct lnet_nid *nid)
 {
        struct lnet_net *net;
        struct lnet_ni *ni;
@@ -4575,7 +4575,7 @@ bool LNetIsPeerLocal(lnet_nid_t nid)
        cpt = lnet_net_lock_current();
        list_for_each_entry(net, &the_lnet.ln_nets, net_list) {
                list_for_each_entry(ni, &net->net_ni_list, ni_netlist) {
-                       if (lnet_nid_to_nid4(&ni->ni_nid) == nid) {
+                       if (nid_same(&ni->ni_nid, nid)) {
                                lnet_net_unlock(cpt);
                                return true;
                        }
index 287eec2..a11825c 100644 (file)
@@ -1971,7 +1971,7 @@ static inline bool ptlrpc_connection_is_local(struct ptlrpc_connection *conn)
        if (nid_same(&conn->c_peer.nid, &conn->c_self))
                return true;
 
-       RETURN(LNetIsPeerLocal(lnet_nid_to_nid4(&conn->c_peer.nid)));
+       RETURN(LNetIsPeerLocal(&conn->c_peer.nid));
 }
 
 /* ptlrpc/niobuf.c */
index b5bddd0..e396ad5 100644 (file)
@@ -1634,7 +1634,7 @@ static int mgc_process_recover_nodemap_log(struct obd_device *obd,
 
        /* don't need to get local config */
        if (cld_is_nodemap(cld) &&
-           LNetIsPeerLocal(lnet_nid_to_nid4(&mgc_conn->c_peer.nid)))
+           LNetIsPeerLocal(&mgc_conn->c_peer.nid))
                GOTO(out, rc = 0);
 
        /* allocate buffer for bulk transfer.
index 3198cc8..681f3d4 100644 (file)
@@ -946,7 +946,7 @@ int tgt_connect_check_sptlrpc(struct ptlrpc_request *req, struct obd_export *exp
                if ((strcmp(exp->exp_obd->obd_type->typ_name,
                            LUSTRE_MGS_NAME) == 0) &&
                    (exp->exp_flvr.sf_rpc == SPTLRPC_FLVR_NULL ||
-                    LNetIsPeerLocal(lnet_nid_to_nid4(&exp->exp_connection->c_peer.nid))))
+                    LNetIsPeerLocal(&exp->exp_connection->c_peer.nid)))
                        exp->exp_flvr.sf_rpc = SPTLRPC_FLVR_ANY;
 
                if (exp->exp_flvr.sf_rpc != SPTLRPC_FLVR_ANY &&
index 7022ceb..b0f200c 100644 (file)
@@ -973,6 +973,7 @@ static int tgt_is_local_client(const struct lu_env *env,
        struct lu_target        *tgt = class_exp2tgt(exp);
        struct tgt_session_info *tsi = tgt_ses_info(env);
        struct ptlrpc_request   *req = tgt_ses_req(tsi);
+       struct lnet_nid nid;
 
        if (exp_connect_flags(exp) & OBD_CONNECT_MDS ||
            exp_connect_flags(exp) & OBD_CONNECT_MDS_MDS)
@@ -981,7 +982,8 @@ static int tgt_is_local_client(const struct lu_env *env,
                return 0;
        if (!req)
                return 0;
-       if (!LNetIsPeerLocal(req->rq_peer.nid))
+       lnet_nid4_to_nid(req->rq_peer.nid, &nid);
+       if (!LNetIsPeerLocal(&nid))
                return 0;
 
        return 1;