Whamcloud - gitweb
LU-14313 utils: mount error when no server support 82/41182/4
authorOlaf Faaland <faaland1@llnl.gov>
Wed, 6 Jan 2021 09:57:26 +0000 (01:57 -0800)
committerOleg Drokin <green@whamcloud.com>
Fri, 26 Feb 2021 08:22:50 +0000 (08:22 +0000)
When the mount utility was built without server support,
and this causes the mount to fail, an error message should
say so.

The error values returned by main() should be positive as
they are exposed to the user.

Upon mount() failure, errno must be checked to determine
the reason for the failure.  The return value is -1.

Test-Parameters: trivial
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Change-Id: I49906340f6ddbe16b7503663cedabe0085daf113
Reviewed-on: https://review.whamcloud.com/41182
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/utils/mount_lustre.c

index 5890e5f..1c9c79b 100644 (file)
@@ -924,7 +924,9 @@ int main(int argc, char *const argv[])
                if (rc)
                        goto out_osd;
 #else
                if (rc)
                        goto out_osd;
 #else
-               rc = -EINVAL;
+               rc = EINVAL;
+               fprintf(stderr, "%s: cannot mount %s: no server support\n",
+                       progname, mop.mo_usource);
                goto out_options;
 #endif
        }
                goto out_options;
 #endif
        }
@@ -993,7 +995,7 @@ int main(int argc, char *const argv[])
                                 * Try with 'lustre' instead.  Eventually this
                                 * can be removed (e.g. 2.18 or whenever).
                                 */
                                 * Try with 'lustre' instead.  Eventually this
                                 * can be removed (e.g. 2.18 or whenever).
                                 */
-                               if (rc == -ENODEV &&
+                               if (errno == ENODEV &&
                                    strcmp(fstype, "lustre_tgt") == 0) {
                                        fstype = "lustre";
                                        i--;
                                    strcmp(fstype, "lustre_tgt") == 0) {
                                        fstype = "lustre";
                                        i--;