From 165cf78ab54e6e8d172f999940c62afabc043cd5 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Sun, 10 Dec 2023 09:50:43 -0500 Subject: [PATCH] LU-16823 lustre: test if large nid is support Update all LNetGetId() calls to use large NIDs if the connect flags report large NID support. For the case of lmv_setup() we update setting qos_rr_index, to avoid the thundering herd, using nidhash(). Change-Id: I80fda9454f154e27fbc75abb1899c0ccca03097b Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53398 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Lai Siyao Reviewed-by: Oleg Drokin --- lustre/llite/llite_lib.c | 12 ++++++++++-- lustre/lmv/lmv_obd.c | 13 ++++++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 68d3926..c190b8e 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -4074,10 +4074,18 @@ void ll_compute_rootsquash_state(struct ll_sb_info *sbi) clear_bit(LL_SBI_NOROOTSQUASH, sbi->ll_flags); else { /* Do not apply root squash as soon as one of our NIDs is - * in the nosquash_nids list */ + * in the nosquash_nids list + */ + struct lustre_sb_info *lsi = sbi->lsi; + bool large_nid = false; + + if (exp_connect_flags2(lsi->lsi_mgc->u.cli.cl_mgc_mgsexp) & + OBD_CONNECT2_LARGE_NID) + large_nid = true; + matched = false; i = 0; - while (LNetGetId(i++, &id, false) != -ENOENT) { + while (LNetGetId(i++, &id, large_nid) != -ENOENT) { if (nid_is_lo0(&id.nid)) continue; if (cfs_match_nid(&id.nid, diff --git a/lustre/lmv/lmv_obd.c b/lustre/lmv/lmv_obd.c index b043a22..3ede80c 100644 --- a/lustre/lmv/lmv_obd.c +++ b/lustre/lmv/lmv_obd.c @@ -1196,9 +1196,9 @@ static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg) * initialize rr_index to lower 32bit of netid, so that client * can distribute subdirs evenly from the beginning. */ - while (LNetGetId(i++, &lnet_id, false) != -ENOENT) { + while (LNetGetId(i++, &lnet_id, true) != -ENOENT) { if (!nid_is_lo0(&lnet_id.nid)) { - lmv->lmv_qos_rr_index = ntohl(lnet_id.nid.nid_addr[0]); + lmv->lmv_qos_rr_index = nidhash(&lnet_id.nid); break; } } @@ -1274,8 +1274,10 @@ out: RETURN(rc); } -static int lmv_select_statfs_mdt(struct lmv_obd *lmv, __u32 flags) +static int lmv_select_statfs_mdt(struct obd_export *exp, struct lmv_obd *lmv, + u32 flags) { + bool large_nid = exp_connect_flags2(exp) & OBD_CONNECT2_LARGE_NID; int i; if (flags & OBD_STATFS_FOR_MDT0) @@ -1287,7 +1289,8 @@ static int lmv_select_statfs_mdt(struct lmv_obd *lmv, __u32 flags) /* choose initial MDT for this client */ for (i = 0;; i++) { struct lnet_processid lnet_id; - if (LNetGetId(i, &lnet_id, false) == -ENOENT) + + if (LNetGetId(i, &lnet_id, large_nid) == -ENOENT) break; if (!nid_is_lo0(&lnet_id.nid)) { @@ -1322,7 +1325,7 @@ static int lmv_statfs(const struct lu_env *env, struct obd_export *exp, RETURN(-ENOMEM); /* distribute statfs among MDTs */ - idx = lmv_select_statfs_mdt(lmv, flags); + idx = lmv_select_statfs_mdt(exp, lmv, flags); for (i = 0; i < lmv->lmv_mdt_descs.ltd_tgts_size; i++, idx++) { idx = idx % lmv->lmv_mdt_descs.ltd_tgts_size; -- 1.8.3.1