* [PATCH nfs-utils 0/2] fixes for protocol fallback on mount
@ 2015-12-17 1:56 NeilBrown
2015-12-17 1:56 ` [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap NeilBrown
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: NeilBrown @ 2015-12-17 1:56 UTC (permalink / raw)
To: Steve Dickson; +Cc: linux-nfs, Andreas Schwab, Takashi Iwai
Two unrelated patches which both relate to protocol fallback
when mounting an NFS filesystem.
---
Andreas Schwab (1):
Fix uninitialised variable usage in nfs_options2pmap
NeilBrown (1):
Fix protocol minor version fall-back
utils/mount/network.c | 5 ++++-
utils/mount/stropts.c | 3 +++
2 files changed, 7 insertions(+), 1 deletion(-)
--
Signature
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap
2015-12-17 1:56 [PATCH nfs-utils 0/2] fixes for protocol fallback on mount NeilBrown
@ 2015-12-17 1:56 ` NeilBrown
2015-12-17 1:56 ` [PATCH 2/2] Fix protocol minor version fall-back NeilBrown
2016-01-16 21:57 ` [PATCH nfs-utils 0/2] fixes for protocol fallback on mount Steve Dickson
2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2015-12-17 1:56 UTC (permalink / raw)
To: Steve Dickson; +Cc: linux-nfs, Andreas Schwab
From: Andreas Schwab <schwab@suse.com>
Commit 5bea22e33b7a introduced a regression. Prior to that commit
nfs_nfs_version would set *version to 0 if NFS version wasn't specified.
Since that commit, version.v_mode is set to V_DEFAULT if the NFS version
isn't specified, but nfs_options2pmap uses version.major without checking
v_mode. This can lead to incorrect behaviour.
In particular fall-ack to v3 if server doesn't support v4 can fail.
So test v_mode before using version.major.
URL: https://bugzilla.opensuse.org/show_bug.cgi?id=956743
Fixes: 5bea22e33b7a ("mount.nfs: Add struct nfs_version and generalize version parsing")
Signed-off-by: NeilBrown <neilb@suse.com>
---
utils/mount/network.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/utils/mount/network.c b/utils/mount/network.c
index ebc39d361e2c..8a9bf1476d51 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -1631,7 +1631,10 @@ int nfs_options2pmap(struct mount_options *options,
return 0;
if (!nfs_nfs_version(options, &version))
return 0;
- nfs_pmap->pm_vers = version.major;
+ if (version.v_mode == V_DEFAULT)
+ nfs_pmap->pm_vers = 0;
+ else
+ nfs_pmap->pm_vers = version.major;
if (!nfs_nfs_protocol(options, &nfs_pmap->pm_prot))
return 0;
if (!nfs_nfs_port(options, &nfs_pmap->pm_port))
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] Fix protocol minor version fall-back
2015-12-17 1:56 [PATCH nfs-utils 0/2] fixes for protocol fallback on mount NeilBrown
2015-12-17 1:56 ` [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap NeilBrown
@ 2015-12-17 1:56 ` NeilBrown
2016-01-16 21:57 ` [PATCH nfs-utils 0/2] fixes for protocol fallback on mount Steve Dickson
2 siblings, 0 replies; 4+ messages in thread
From: NeilBrown @ 2015-12-17 1:56 UTC (permalink / raw)
To: Steve Dickson; +Cc: linux-nfs, Takashi Iwai
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;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH nfs-utils 0/2] fixes for protocol fallback on mount
2015-12-17 1:56 [PATCH nfs-utils 0/2] fixes for protocol fallback on mount NeilBrown
2015-12-17 1:56 ` [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap NeilBrown
2015-12-17 1:56 ` [PATCH 2/2] Fix protocol minor version fall-back NeilBrown
@ 2016-01-16 21:57 ` Steve Dickson
2 siblings, 0 replies; 4+ messages in thread
From: Steve Dickson @ 2016-01-16 21:57 UTC (permalink / raw)
To: NeilBrown; +Cc: linux-nfs, Andreas Schwab, Takashi Iwai
On 12/16/2015 08:56 PM, NeilBrown wrote:
> Two unrelated patches which both relate to protocol fallback
> when mounting an NFS filesystem.
>
> ---
>
> Andreas Schwab (1):
> Fix uninitialised variable usage in nfs_options2pmap
>
> NeilBrown (1):
> Fix protocol minor version fall-back
Both patches committed! Thank you!!
steved.
>
>
> utils/mount/network.c | 5 ++++-
> utils/mount/stropts.c | 3 +++
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
> --
> Signature
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-01-16 21:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-17 1:56 [PATCH nfs-utils 0/2] fixes for protocol fallback on mount NeilBrown
2015-12-17 1:56 ` [PATCH 1/2] Fix uninitialised variable usage in nfs_options2pmap NeilBrown
2015-12-17 1:56 ` [PATCH 2/2] Fix protocol minor version fall-back NeilBrown
2016-01-16 21:57 ` [PATCH nfs-utils 0/2] fixes for protocol fallback on mount Steve Dickson
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).