fixes for protocol fallback on mount
Subsystems (2)
cover fixes for protocol fallback on mount
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
PATCH 1/2 Fix uninitialised variable usage in nfs_options2pmap
From: Andreas Schwab <[email protected]>
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
--- utils/mount/network.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
utils/mount/network.c +4 -1
@@ -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))
PATCH 2/2 Fix protocol minor version fall-back
In reply to NeilBrownmount.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
--- utils/mount/stropts.c | 3 +++ 1 file changed, 3 insertions(+)
utils/mount/stropts.c +3 -0
@@ -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;
Quoted 10 lines · NeilBrown
Two unrelated patches which both relate to protocol fallback when mounting an NFS filesystem.
---
Andreas Schwab (1):
Fix uninitialised variable usage innfs_options2pmapNeilBrown (1):
Fix protocol minor version fall-back
Both patches committed! Thank you!!
steved.
Quoted 9 lines
utils/mount/network.c | 5 ++++- utils/mount/stropts.c | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-)--
Signature