Whamcloud - gitweb
LU-2022 utils: Mount MGS lacking index
[fs/lustre-release.git] / lustre / utils / mkfs_lustre.c
index fee1d03..22bf661 100644 (file)
@@ -587,6 +587,8 @@ int main(int argc, char *const argv[])
                         "(%d)\n", mop.mo_device, ret);
                 goto out;
         }
+       mop.mo_ldd.ldd_flags &= ~(LDD_F_WRITECONF | LDD_F_VIRGIN);
+
         if (strstr(mop.mo_ldd.ldd_params, PARAM_MGSNODE))
             mop.mo_mgs_failnodes++;
 
@@ -618,6 +620,10 @@ int main(int argc, char *const argv[])
                 goto out;
         }
 
+       /* Stand alone MGS doesn't need a index */
+       if (!IS_MDT(ldd) && IS_MGS(ldd))
+               mop.mo_ldd.ldd_flags &= ~LDD_F_NEED_INDEX;
+
         if ((mop.mo_ldd.ldd_flags & (LDD_F_NEED_INDEX | LDD_F_UPGRADE14)) ==
             (LDD_F_NEED_INDEX | LDD_F_UPGRADE14)) {
                 fatal();
@@ -626,6 +632,12 @@ int main(int argc, char *const argv[])
                 ret = EINVAL;
                 goto out;
         }
+
+       if (IS_OST(ldd) && (mop.mo_ldd.ldd_flags & LDD_F_NEED_INDEX))
+               fprintf(stderr, "warning: %s: for Lustre 2.4 and later, the "
+                       "target index must be specified with --index\n",
+                       mop.mo_device);
+
 #if 0
         /*
          * Comment out these 2 checks temporarily, since for multi-MDSes
@@ -741,6 +753,14 @@ int main(int argc, char *const argv[])
                 fprintf(stderr, "mkfs failed %d\n", ret);
                 goto out;
         }
+#else
+       /* update svname with '=' to refresh config */
+       if (mop.mo_ldd.ldd_flags & LDD_F_WRITECONF) {
+               struct mount_opts opts;
+               opts.mo_ldd = mop.mo_ldd;
+               opts.mo_source = mop.mo_device;
+               (void) osd_label_lustre(&opts);
+       }
 #endif
 
         /* Write our config files */