From 7af92d8843f7e526e69c7e6ca66352be1ea94174 Mon Sep 17 00:00:00 2001 From: Olaf Faaland Date: Wed, 6 Jan 2021 01:57:26 -0800 Subject: [PATCH] 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 --- lustre/utils/mount_lustre.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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--; -- 1.8.3.1