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@vger.kernel.org, Takashi Iwai <tiwai@suse.com>
Subject: [PATCH 2/2] Fix protocol minor version fall-back
Date: Thu, 17 Dec 2015 12:56:34 +1100	[thread overview]
Message-ID: <20151217015634.19978.65001.stgit@noble> (raw)
In-Reply-To: <20151217015524.19978.63114.stgit@noble>

mount.nfs currently expects mount(2) to fail with EPROTONOSUPPORT if
the kernel doesn't understand the requested NFS version.

Unfortunately if the requested minor is not known to the kernel
it returns -EINVAL.
In kernels since 3.11 this can happen in nfs4_alloc_client(), if
compiled without NFS_V4_2.

More generally it can happen in in nfs_validate_text_mount_data()
when nfs_parse_mount_options() returns 0 because nfs_parse_version_string()
didn't recognise the version.

EPROTONOSUPPORT is only returned if NFSv4 support is completely compiled out.

So nfs_autonegotiate needs to check for EINVAL as well as EPROTONOSUPPORT.

URL: https://bugzilla.opensuse.org/show_bug.cgi?id=959211
Reported-by: Takashi Iwai <tiwai@suse.com>
Signed-off-by: NeilBrown <neilb@suse.com>
---
 utils/mount/stropts.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index c8f5a6d223e7..86829a902bfd 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -841,6 +841,9 @@ check_result:
 	case EPROTONOSUPPORT:
 		/* A clear indication that the server or our
 		 * client does not support NFS version 4 and minor */
+	case EINVAL:
+		/* A less clear indication that our client
+		 * does not support NFSv4 minor version. */
 		if (mi->version.v_mode == V_GENERAL &&
 			mi->version.minor == 0)
 				return result;



  reply	other threads:[~2015-12-17  1:58 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-17  1:56 [PATCH nfs-utils 0/2] fixes for protocol fallback on mount NeilBrown
2015-12-17  1:56 ` NeilBrown [this message]
2015-12-17  1:56 ` [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap NeilBrown
2016-01-16 21:57 ` [PATCH nfs-utils 0/2] fixes for protocol fallback on mount 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=20151217015634.19978.65001.stgit@noble \
    --to=neilb@suse.com \
    --cc=SteveD@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tiwai@suse.com \
    /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).