From 80a4a2ebe0a269d564e13b0931c9852379da86d8 Mon Sep 17 00:00:00 2001 From: Mr NeilBrown Date: Thu, 26 May 2022 16:20:04 +1000 Subject: [PATCH] LU-10391 ptlrpc: switch sptlrpc_rule_set_choose to large nid 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 Change-Id: Id4e8083d31c0393e2ef748babb6b851501b8d46f Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/50102 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Sebastien Buisson Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/include/lustre_sec.h | 4 ++-- lustre/ptlrpc/sec.c | 2 +- lustre/ptlrpc/sec_config.c | 12 ++++++------ lustre/target/tgt_handler.c | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lustre/include/lustre_sec.h b/lustre/include/lustre_sec.h index 0db5e65..c6e5202 100644 --- a/lustre/include/lustre_sec.h +++ b/lustre/include/lustre_sec.h @@ -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, diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 7437434..bd152ba 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -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)) { diff --git a/lustre/ptlrpc/sec_config.c b/lustre/ptlrpc/sec_config.c index ee7e019..69596b5 100644 --- a/lustre/ptlrpc/sec_config.c +++ b/lustre/ptlrpc/sec_config.c @@ -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) diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index 6c0192b..dc518a2 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -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); -- 1.8.3.1