Whamcloud - gitweb
LU-16823 lustre: test if large nid is support 98/53398/2
authorJames Simmons <jsimmons@infradead.org>
Sun, 10 Dec 2023 14:50:43 +0000 (09:50 -0500)
committerOleg Drokin <green@whamcloud.com>
Wed, 3 Jan 2024 03:03:40 +0000 (03:03 +0000)
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 <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53398
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/llite_lib.c
lustre/lmv/lmv_obd.c

index 68d3926..c190b8e 100644 (file)
@@ -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,
index b043a22..3ede80c 100644 (file)
@@ -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;