Whamcloud - gitweb
LU-18012 obd: support large NIDs when MGS is down 07/55907/6
authorJames Simmons <jsimmons@infradead.org>
Thu, 1 Aug 2024 19:23:39 +0000 (13:23 -0600)
committerOleg Drokin <green@whamcloud.com>
Fri, 16 Aug 2024 23:48:41 +0000 (23:48 +0000)
When the mgc is initialized it will create an export for the MGS.
Having a MGS export does not mean we can actually reach the
remote MGS. The way to know if the MGS is reachable is to examine
the connect flags after obd_connect() is called. If its zero
then the remote MGS is down. If this is the case since when
starting the mgc we examine the mgsnode= string we can examine
every NID. If one of those NIDs for mgsnode= or the failover
has a large NID address then force support for large NIDs.

Change-Id: I3550df21618f07b69701a9d337d3dfc5f99e49a3
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55907
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/obdclass/obd_mount.c

index 8e6ffc6..5c0d945 100644 (file)
@@ -238,6 +238,7 @@ int lustre_start_mgc(struct super_block *sb)
        struct lnet_nid nid;
        char nidstr[LNET_NIDSTR_SIZE];
        char *mgcname = NULL, *niduuid = NULL, *mgssec = NULL;
+       bool large_nids = false;
        char *ptr;
        int rc = 0, i = 0, j;
        size_t len;
@@ -252,10 +253,13 @@ int lustre_start_mgc(struct super_block *sb)
                ptr = lsi->lsi_lmd->lmd_mgs;
                if (lsi->lsi_lmd->lmd_mgs &&
                    (class_parse_nid(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) {
+                       if (!nid_is_nid4(&nid))
+                               large_nids = true;
                        i++;
                } else if (IS_MGS(lsi)) {
                        struct lnet_processid id;
 
+                       large_nids = true;
                        while ((rc = LNetGetId(i++, &id, true)) != -ENOENT) {
                                if (nid_is_lo0(&id.nid))
                                        continue;
@@ -267,8 +271,11 @@ int lustre_start_mgc(struct super_block *sb)
        } else { /* client */
                /* Use NIDs from mount line: uml1,1@elan:uml2,2@elan:/lustre */
                ptr = lsi->lsi_lmd->lmd_dev;
-               if (class_parse_nid(ptr, &nid, &ptr) == 0)
+               if (class_parse_nid(ptr, &nid, &ptr) == 0) {
+                       if (!nid_is_nid4(&nid))
+                               large_nids = true;
                        i++;
+               }
        }
        if (i == 0) {
                CERROR("No valid MGS NIDs found.\n");
@@ -440,6 +447,9 @@ int lustre_start_mgc(struct super_block *sb)
                sprintf(niduuid, "%s_%x", mgcname, i);
                j = 0;
                while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
+                       if (!nid_is_nid4(&nid))
+                               large_nids = true;
+
                        rc = do_lcfg_nid(mgcname, &nid, LCFG_ADD_UUID,
                                         niduuid);
                        if (rc == 0)
@@ -496,8 +506,17 @@ int lustre_start_mgc(struct super_block *sb)
                GOTO(out, rc);
        }
 
+       /* Having a MGS export setup does not mean we can reach it. When this
+        * is the case check the connect flags which will be zero since we
+        * couldn't reach the MGS. If the mgsnode= contains a large NID we
+        * should enable large NID support so we can mount on servers when
+        * the MGS is down.
+        */
+       if (exp_connect_flags(exp) == 0 && large_nids) {
+               exp->exp_connect_data.ocd_connect_flags = OBD_CONNECT_FLAGS2;
+               exp->exp_connect_data.ocd_connect_flags2 = OBD_CONNECT2_LARGE_NID;
+       }
        obd->u.cli.cl_mgc_mgsexp = exp;
-
 out:
        /*
         * Keep the MGC info in the sb. Note that many lsi's can point