From: Olaf Faaland Date: Wed, 6 Jan 2021 09:57:26 +0000 (-0800) Subject: LU-14313 utils: mount error when no server support X-Git-Tag: 2.14.51~167 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=7af92d8843f7e526e69c7e6ca66352be1ea94174;p=fs%2Flustre-release.git LU-14313 utils: mount error when no server support 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 Change-Id: I49906340f6ddbe16b7503663cedabe0085daf113 Reviewed-on: https://review.whamcloud.com/41182 Tested-by: jenkins Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index 5890e5f..1c9c79b 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -924,7 +924,9 @@ int main(int argc, char *const argv[]) 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 } @@ -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). */ - if (rc == -ENODEV && + if (errno == ENODEV && strcmp(fstype, "lustre_tgt") == 0) { fstype = "lustre"; i--;