Whamcloud - gitweb
LU-10391 ptlrpc: switch sptlrpc_rule_set_choose to large nid 02/50102/7
authorMr NeilBrown <neilb@suse.de>
Thu, 26 May 2022 06:20:04 +0000 (16:20 +1000)
committerOleg Drokin <green@whamcloud.com>
Wed, 31 May 2023 19:02:45 +0000 (19:02 +0000)
sptlrpc_rule_set_choose() and sptlrpc_target_choose_flavor() now take
a large nid.  Only the net number is needed, so this is quite straight
forward.

Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: Id4e8083d31c0393e2ef748babb6b851501b8d46f
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50102
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/lustre_sec.h
lustre/ptlrpc/sec.c
lustre/ptlrpc/sec_config.c
lustre/target/tgt_handler.c

index 0db5e65..c6e5202 100644 (file)
@@ -376,7 +376,7 @@ int  sptlrpc_rule_set_merge(struct sptlrpc_rule_set *set,
 int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
                            enum lustre_sec_part from,
                            enum lustre_sec_part to,
-                           lnet_nid_t nid,
+                           struct lnet_nid *nid,
                            struct sptlrpc_flavor *sf);
 void sptlrpc_rule_set_dump(struct sptlrpc_rule_set *set);
 
@@ -390,7 +390,7 @@ int  sptlrpc_conf_target_get_rules(struct obd_device *obd,
                                   struct sptlrpc_rule_set *rset);
 void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
                                  enum lustre_sec_part from,
-                                 lnet_nid_t nid,
+                                 struct lnet_nid *nid,
                                  struct sptlrpc_flavor *flavor);
 
 /* The maximum length of security payload. 1024 is enough for Kerberos 5,
index 7437434..bd152ba 100644 (file)
@@ -2140,7 +2140,7 @@ void sptlrpc_target_update_exp_flavor(struct obd_device *obd,
                 */
                spin_lock(&exp->exp_lock);
                sptlrpc_target_choose_flavor(rset, exp->exp_sp_peer,
-                                            lnet_nid_to_nid4(&exp->exp_connection->c_peer.nid),
+                                            &exp->exp_connection->c_peer.nid,
                                             &new_flvr);
                if (exp->exp_flvr_changed ||
                    !flavor_equal(&new_flvr, &exp->exp_flvr)) {
index ee7e019..69596b5 100644 (file)
@@ -397,7 +397,7 @@ EXPORT_SYMBOL(sptlrpc_rule_set_merge);
 int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
                            enum lustre_sec_part from,
                            enum lustre_sec_part to,
-                           lnet_nid_t nid,
+                           struct lnet_nid *nid,
                            struct sptlrpc_flavor *sf)
 {
        struct sptlrpc_rule *r;
@@ -406,9 +406,9 @@ int sptlrpc_rule_set_choose(struct sptlrpc_rule_set *rset,
        for (n = 0; n < rset->srs_nrule; n++) {
                r = &rset->srs_rules[n];
 
-               if (LNET_NIDNET(nid) != LNET_NET_ANY &&
+               if (!LNET_NID_IS_ANY(nid) &&
                    r->sr_netid != LNET_NET_ANY &&
-                   LNET_NIDNET(nid) != r->sr_netid)
+                   __be16_to_cpu(nid->nid_num) != r->sr_netid)
                        continue;
 
                if (from != LUSTRE_SP_ANY && r->sr_from != LUSTRE_SP_ANY &&
@@ -858,13 +858,13 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,
        conf_tgt = sptlrpc_conf_get_tgt(conf, name, 0);
        if (conf_tgt) {
                rc = sptlrpc_rule_set_choose(&conf_tgt->sct_rset,
-                                            from, to, lnet_nid_to_nid4(nid), sf);
+                                            from, to, nid, sf);
                if (rc)
                        goto out;
        }
 
        rc = sptlrpc_rule_set_choose(&conf->sc_rset, from, to,
-                                    lnet_nid_to_nid4(nid), sf);
+                                    nid, sf);
 out:
        mutex_unlock(&sptlrpc_conf_lock);
 
@@ -880,7 +880,7 @@ out:
  */
 void sptlrpc_target_choose_flavor(struct sptlrpc_rule_set *rset,
                                  enum lustre_sec_part from,
-                                 lnet_nid_t nid,
+                                 struct lnet_nid *nid,
                                  struct sptlrpc_flavor *sf)
 {
        if (sptlrpc_rule_set_choose(rset, from, LUSTRE_SP_ANY, nid, sf) == 0)
index 6c0192b..dc518a2 100644 (file)
@@ -951,7 +951,7 @@ int tgt_connect_check_sptlrpc(struct ptlrpc_request *req, struct obd_export *exp
                read_lock(&tgt->lut_sptlrpc_lock);
                sptlrpc_target_choose_flavor(&tgt->lut_sptlrpc_rset,
                                             req->rq_sp_from,
-                                            lnet_nid_to_nid4(&req->rq_peer.nid),
+                                            &req->rq_peer.nid,
                                             &flvr);
                read_unlock(&tgt->lut_sptlrpc_lock);