Whamcloud - gitweb
LU-12514 utils: try lustre_tgt filesystem for mount 99/38799/7
authorJames Simmons <jsimmons@infradead.org>
Sun, 21 Jun 2020 14:36:17 +0000 (10:36 -0400)
committerOleg Drokin <green@whamcloud.com>
Fri, 10 Jul 2020 16:52:22 +0000 (16:52 +0000)
Now that Lustre supports a separate file system for the server
targets we can update mount.lustre to try "lustre_tgt" for the
server backend. For backwards compatibility if using "lustre_tgt"
fails try the original "lustre" file system type.

Change-Id: Ica08ff2abc3ad06c78d6d435db7e2fa3897e037e
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/38799
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
lustre/utils/mount_lustre.c

index 820dc7f..a966613 100644 (file)
@@ -962,15 +962,26 @@ int main(int argc, char *const argv[])
 #endif /* HAVE_GSS */
 
        if (!mop.mo_fake) {
+               char *fstype = client ? "lustre" : "lustre_tgt";
+
                /*
                 * flags and target get to lustre_get_sb(), but not
                 * lustre_fill_super().  Lustre ignores the flags, but mount
                 * does not.
                 */
                for (i = 0, rc = -EAGAIN; i <= mop.mo_retry && rc != 0; i++) {
-                       rc = mount(mop.mo_source, mop.mo_target, "lustre",
+                       rc = mount(mop.mo_source, mop.mo_target, fstype,
                                   flags, (void *)options);
                        if (rc != 0) {
+                               /* Older Lustre without 'lustre_tgt'.
+                                * Try 'lustre' instead
+                                */
+                               if (rc == -ENODEV) {
+                                       fstype = "lustre";
+                                       i--;
+                                       continue;
+                               }
+
                                if (verbose) {
                                        fprintf(stderr,
                                                "%s: mount %s at %s failed: %s retries left: %d\n",