* [PATCH] mount: make sure mount correctly when kernel not support NFSv4 @ 2010-11-25 5:54 Mi Jinlong 2010-11-29 14:40 ` Chuck Lever 0 siblings, 1 reply; 4+ messages in thread From: Mi Jinlong @ 2010-11-25 5:54 UTC (permalink / raw) To: Steve Dickson; +Cc: NFSv3 list 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. nfs-utils should continue to try mounting NFSv3 when meeting that. Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> --- 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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] mount: make sure mount correctly when kernel not support NFSv4 2010-11-25 5:54 [PATCH] mount: make sure mount correctly when kernel not support NFSv4 Mi Jinlong @ 2010-11-29 14:40 ` Chuck Lever 2010-11-30 6:54 ` Mi Jinlong 0 siblings, 1 reply; 4+ messages in thread From: Chuck Lever @ 2010-11-29 14:40 UTC (permalink / raw) To: Mi Jinlong; +Cc: Steve Dickson, NFSv3 list 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@cn.fujitsu.com> > --- > 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@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Chuck Lever chuck[dot]lever[at]oracle[dot]com ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mount: make sure mount correctly when kernel not support NFSv4 2010-11-29 14:40 ` Chuck Lever @ 2010-11-30 6:54 ` Mi Jinlong 2010-11-30 15:13 ` Chuck Lever 0 siblings, 1 reply; 4+ messages in thread From: Mi Jinlong @ 2010-11-30 6:54 UTC (permalink / raw) To: Chuck Lever; +Cc: Steve Dickson, NFSv3 list, Trond.Myklebust Chuck Lever : > 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? Yes, what about the following patch. -- thanks Mi Jinlong --------------------------------------------------------------------------------- ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] mount: make sure mount correctly when kernel not support NFSv4 2010-11-30 6:54 ` Mi Jinlong @ 2010-11-30 15:13 ` Chuck Lever 0 siblings, 0 replies; 4+ messages in thread From: Chuck Lever @ 2010-11-30 15:13 UTC (permalink / raw) To: Mi Jinlong; +Cc: Steve Dickson, NFSv3 list, Trond.Myklebust On Nov 30, 2010, at 1:54 AM, Mi Jinlong wrote: > > > Chuck Lever : >> 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? > > Yes, what about the following patch. Seems logical to me. Up to Trond... > > -- > thanks > Mi Jinlong > --------------------------------------------------------------------------------- > From 4065f2571362ff301683218546151e19148fa775 Mon Sep 17 00:00:00 2001 > From: Mi Jinlong <mijinlong@cn.fujitsu.com> > Date: Sat, 30 Oct 2010 10:19:33 +0800 > Subject: [PATCH] nfs: kernel should return EPROTONOSUPPORT when not support NFSv4 > > When nfs client(kernel) don't support NFSv4, maybe user build > kernel without NFSv4, there is a problem. > > Using command "mount SERVER-IP:/nfsv3 /mnt/" to mount NFSv3 > filesystem, mount should should success, but fail and get error: > > "mount.nfs: an incorrect mount option was specified" > > System call mount "nfs"(not "nfs4") with "vers=4", > if CONFIG_NFS_V4 is not defined, the "vers=4" will be parsed > as invalid argument and kernel return EINVAL to nfs-utils. > > About that, we really want get EPROTONOSUPPORT rather than > EINVAL. This path make sure kernel parses argument success, > and return EPROTONOSUPPORT at nfs_validate_mount_data(). > > Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com> > --- > fs/nfs/super.c | 4 ---- > 1 files changed, 0 insertions(+), 4 deletions(-) > > diff --git a/fs/nfs/super.c b/fs/nfs/super.c > index 3c04504..4100630 100644 > --- a/fs/nfs/super.c > +++ b/fs/nfs/super.c > @@ -1069,12 +1069,10 @@ static int nfs_parse_mount_options(char *raw, > mnt->flags |= NFS_MOUNT_VER3; > mnt->version = 3; > break; > -#ifdef CONFIG_NFS_V4 > case Opt_v4: > mnt->flags &= ~NFS_MOUNT_VER3; > mnt->version = 4; > break; > -#endif > case Opt_udp: > mnt->flags &= ~NFS_MOUNT_TCP; > mnt->nfs_server.protocol = XPRT_TRANSPORT_UDP; > @@ -1286,12 +1284,10 @@ static int nfs_parse_mount_options(char *raw, > mnt->flags |= NFS_MOUNT_VER3; > mnt->version = 3; > break; > -#ifdef CONFIG_NFS_V4 > case NFS4_VERSION: > mnt->flags &= ~NFS_MOUNT_VER3; > mnt->version = 4; > break; > -#endif > default: > goto out_invalid_value; > } > -- > 1.7.3.2 > > -- Chuck Lever chuck[dot]lever[at]oracle[dot]com ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-11-30 15:14 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-11-25 5:54 [PATCH] mount: make sure mount correctly when kernel not support NFSv4 Mi Jinlong 2010-11-29 14:40 ` Chuck Lever 2010-11-30 6:54 ` Mi Jinlong 2010-11-30 15:13 ` Chuck Lever
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.