linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Steve Dickson <SteveD@redhat.com>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: [PATCH] mount.nfs - hide EBUSY errors.
Date: Thu, 18 Feb 2016 13:59:17 +1100	[thread overview]
Message-ID: <877fi2raey.fsf@notabene.neil.brown.name> (raw)

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


Linux only returns EBUSY for a non-remount mount if the exact
requested filesystem is already mounted.  Arguably this is not an
error.

"mount -a" tries to see if each requested filesystem is already mounted.
Sometimes it gets it wrong - e.g. hostname aliases can confuse it.
So "mount -a" will report a failure "already mounted", which is
wrong because it should filter those out.

An easy fix it just to be silent about EBUSY.  As the requested
result (a given filesystem being mounted at a given location) is in
effect after the EBUSY return, we can just treat it as success.

This removes the confusing "already mounted" errors.

Signed-off-by: NeilBrown <neilb@suse.com>
---
 utils/mount/stropts.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index 86829a902bfd..320dde2fab92 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -960,6 +960,15 @@ static int nfsmount_fg(struct nfsmount_info *mi)
 		if (nfs_try_mount(mi))
 			return EX_SUCCESS;
 
+		if (errno == EBUSY)
+			/* The only cause of EBUSY is if exactly the desired
+			 * filesystem is already mounted.  That can arguably
+			 * be seen as success.  "mount -a" tries to optimise
+			 * out this case but sometimes fails.  Help it out
+			 * by pretending everything is rosy
+			 */
+			return EX_SUCCESS;
+
 		if (nfs_is_permanent_error(errno))
 			break;
 
-- 
2.7.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

             reply	other threads:[~2016-02-18  2:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-18  2:59 NeilBrown [this message]
2016-03-16 18:19 ` [PATCH] mount.nfs - hide EBUSY errors 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=877fi2raey.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).