File 0020-mount-improve-error-message-when-statd-cannot-be-sta.patch of Package nfs-utils.3350

Commit: 5cbb78bf4bd871168ada54b0fd4b42b26c959f3e
References: bsc#853478
From: NeilBrown <neilb@suse.de>
Date: Thu, 26 Mar 2015 11:27:27 -0400
Subject: [PATCH] mount: improve error message when statd cannot be started.

If you try to mount and NFSv3 filesystem, and statd is not running
and cannot be started (maybe rpcbind isn't running either), the
error message is:

  mount.nfs: rpc.statd is not running but is required for remote locking.
  mount.nfs: Either use '-o nolock' to keep locks local, or start statd.
  mount.nfs: an incorrect mount option was specified

That last line is incorrect and misleading: no incorret mount option was
specified.

This line comes from mount_error() in error.c.  In this case that
function doesn't really need to provide any more information.

So introduce a concention that EALREADY means an error message has
already been printed, and use it to suppress that message.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
 utils/mount/error.c   |    3 +++
 utils/mount/stropts.c |    1 +
 2 files changed, 4 insertions(+)

--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -243,6 +243,9 @@ void mount_error(const char *spec, const
 		nfs_error(_("%s: please report the error to" PACKAGE_BUGREPORT),
 				progname);
 		break;
+	case EALREADY:
+		/* Error message has already been provided */
+		break;
 	default:
 		nfs_error(_("%s: %s"),
 			progname, strerror(error));
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -278,6 +278,7 @@ static int nfs_verify_lock_option(struct
 			    "required for remote locking."), progname);
 		nfs_error(_("%s: Either use '-o nolock' to keep "
 			    "locks local, or start statd."), progname);
+		errno = EALREADY; /* Don't print further error message */
 		return 0;
 	}