All of lore.kernel.org
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Steve Dickson <SteveD@redhat.com>, NFS <linux-nfs@vger.kernel.org>
Subject: [PATCH - nfs-utils] mount: improve error message when statd cannot be started.
Date: Mon, 23 Mar 2015 16:44:14 +1100	[thread overview]
Message-ID: <20150323164414.7eca921f@notabene.brown> (raw)

[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]



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>

diff --git a/utils/mount/error.c b/utils/mount/error.c
index e06f598e96e3..c9797fc380c4 100644
--- a/utils/mount/error.c
+++ b/utils/mount/error.c
@@ -247,6 +247,9 @@ void mount_error(const char *spec, const char *mount_point, int error)
 		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));
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 76ecb3292860..df67facdd9d1 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -298,6 +298,7 @@ static int nfs_verify_lock_option(struct mount_options *options)
 			    "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;
 	}
 

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

             reply	other threads:[~2015-03-23  5:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-23  5:44 NeilBrown [this message]
2015-03-26 15:30 ` [PATCH - nfs-utils] mount: improve error message when statd cannot be started Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150323164414.7eca921f@notabene.brown \
    --to=neilb@suse.de \
    --cc=SteveD@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.