Re: [PATCH] mount: make sure mount correctly when kernel not support NFSv4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 25, 2010, at 12:54 AM, Mi Jinlong wrote:

> When user's nfs client(kernel) don't support NFSv4, maybe they build
> kernel without NFSv4, there is a problem.
> 
> When using command "mount SERVER-IP:/nfsv3 /mnt/" to mount NFSv3
> filesystem, mount will fail and get error:
> 
> "mount.nfs: an incorrect mount option was specified"
> 
> as above, the mount should success, but it fail.
> 
> When the mount command without specific NFS version, nfs-utils will
> try to mount NFSv4 at first, but the kernel don't support, the kernel
> will return with error EINVAL for parsing option (vers=4) fail.

Maybe the kernel should return EOPNOTSUPP in that case?

> nfs-utils should continue to try mounting NFSv3 when meeting that.
> 
> Signed-off-by: Mi Jinlong <mijinlong@xxxxxxxxxxxxxx>
> ---
> utils/mount/stropts.c |    4 ++++
> 1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index 50a1a2a..e880c45 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -788,6 +788,10 @@ static int nfs_autonegotiate(struct nfsmount_info *mi)
> 		/* Linux servers prior to 2.6.25 may return
> 		 * EPERM when NFS version 4 is not supported. */
> 		goto fall_back;
> +	case EINVAL:
> +		/* If Linux kernel don't support NFSv4, the EINVAL
> +		 * will be return for parsing option (vers=4) fail. */
> +		goto fall_back;
> 	default:
> 		return result;
> 	}
> -- 
> 1.7.3.2
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com




--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux