* [PATCH 0/2] Two short pieces for nfs-utils
@ 2009-10-26 21:03 Chuck Lever
[not found] ` <20091026210110.14346.90636.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Chuck Lever @ 2009-10-26 21:03 UTC (permalink / raw)
To: steved; +Cc: linux-nfs
Hi Steve-
Here are two bug fixes for recent commits to nfs-utils. The
nfs_set_version fix was revised based on review comments.
---
Chuck Lever (2):
mount: Fix po_join() call site in nfs_try_mount_v4()
mount.nfs: Assume v2/v3 if mount-related options are present
utils/mount/stropts.c | 55 +++++++++++++++++++++++++++++++++++--------------
1 files changed, 39 insertions(+), 16 deletions(-)
--
Chuck Lever <chuck.lever@oracle.com>
^ permalink raw reply [flat|nested] 5+ messages in thread[parent not found: <20091026210110.14346.90636.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>]
* [PATCH 1/2] mount.nfs: Assume v2/v3 if mount-related options are present [not found] ` <20091026210110.14346.90636.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org> @ 2009-10-26 21:03 ` Chuck Lever [not found] ` <20091026210319.14346.20494.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org> 2009-10-26 21:03 ` [PATCH 2/2] mount: Fix po_join() call site in nfs_try_mount_v4() Chuck Lever 1 sibling, 1 reply; 5+ messages in thread From: Chuck Lever @ 2009-10-26 21:03 UTC (permalink / raw) To: steved; +Cc: linux-nfs Don't try NFSv4 if any MNT protocol related options were presented by the user. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- utils/mount/stropts.c | 52 +++++++++++++++++++++++++++++++++++-------------- 1 files changed, 37 insertions(+), 15 deletions(-) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index ceefdb0..0f1061c 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -259,24 +259,11 @@ static int nfs_append_sloppy_option(struct mount_options *options) return 1; } -/* - * Set up mandatory non-version specific NFS mount options. - * - * Returns 1 if successful; otherwise zero. - */ -static int nfs_validate_options(struct nfsmount_info *mi) +static int nfs_set_version(struct nfsmount_info *mi) { - struct sockaddr *sap = (struct sockaddr *)&mi->address; - - if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL)) - return 0; - - mi->salen = sizeof(mi->address); - if (!nfs_name_to_address(mi->hostname, sap, &mi->salen)) - return 0; - if (!nfs_nfs_version(mi->options, &mi->version)) return 0; + if (strncmp(mi->type, "nfs4", 4) == 0) mi->version = 4; else { @@ -284,6 +271,19 @@ static int nfs_validate_options(struct nfsmount_info *mi) if (option && strcmp(option, "rdma") == 0) mi->version = 3; } + + /* + * If we still don't know, check for version-specific + * mount options. + */ + if (mi->version == 0) { + if (po_contains(mi->options, "mounthost") || + po_contains(mi->options, "mountaddr") || + po_contains(mi->options, "mountvers") || + po_contains(mi->options, "mountproto")) + mi->version = 3; + } + /* * Use the default value set in the config file when * the version has not been explicitly set. @@ -293,6 +293,28 @@ static int nfs_validate_options(struct nfsmount_info *mi) mi->version = config_default_vers; } + return 1; +} + +/* + * Set up mandatory non-version specific NFS mount options. + * + * Returns 1 if successful; otherwise zero. + */ +static int nfs_validate_options(struct nfsmount_info *mi) +{ + struct sockaddr *sap = (struct sockaddr *)&mi->address; + + if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL)) + return 0; + + mi->salen = sizeof(mi->address); + if (!nfs_name_to_address(mi->hostname, sap, &mi->salen)) + return 0; + + if (!nfs_set_version(mi)) + return 0; + if (!nfs_append_sloppy_option(mi->options)) return 0; ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <20091026210319.14346.20494.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>]
* Re: [PATCH 1/2] mount.nfs: Assume v2/v3 if mount-related options are present [not found] ` <20091026210319.14346.20494.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org> @ 2009-11-03 17:55 ` Steve Dickson 0 siblings, 0 replies; 5+ messages in thread From: Steve Dickson @ 2009-11-03 17:55 UTC (permalink / raw) To: Chuck Lever; +Cc: linux-nfs On 10/26/2009 05:03 PM, Chuck Lever wrote: > Don't try NFSv4 if any MNT protocol related options were presented by > the user. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Committed.. steved ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] mount: Fix po_join() call site in nfs_try_mount_v4() [not found] ` <20091026210110.14346.90636.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org> 2009-10-26 21:03 ` [PATCH 1/2] mount.nfs: Assume v2/v3 if mount-related options are present Chuck Lever @ 2009-10-26 21:03 ` Chuck Lever [not found] ` <20091026210327.14346.15937.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org> 1 sibling, 1 reply; 5+ messages in thread From: Chuck Lever @ 2009-10-26 21:03 UTC (permalink / raw) To: steved; +Cc: linux-nfs Make sure the copied options string is freed in case po_join() fails. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- utils/mount/stropts.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 0f1061c..2d74a54 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -605,12 +605,13 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi) errno = EINVAL; goto out_fail; } + /* * Update option string to be recorded in /etc/mtab. */ if (po_join(options, mi->extra_opts) == PO_FAILED) { errno = ENOMEM; - return 0; + goto out_fail; } result = nfs_sys_mount(mi, options); ^ permalink raw reply related [flat|nested] 5+ messages in thread
[parent not found: <20091026210327.14346.15937.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>]
* Re: [PATCH 2/2] mount: Fix po_join() call site in nfs_try_mount_v4() [not found] ` <20091026210327.14346.15937.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org> @ 2009-11-03 17:56 ` Steve Dickson 0 siblings, 0 replies; 5+ messages in thread From: Steve Dickson @ 2009-11-03 17:56 UTC (permalink / raw) To: Chuck Lever; +Cc: linux-nfs On 10/26/2009 05:03 PM, Chuck Lever wrote: > Make sure the copied options string is freed in case po_join() fails. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > Committed... steved. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-11-03 17:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-26 21:03 [PATCH 0/2] Two short pieces for nfs-utils Chuck Lever
[not found] ` <20091026210110.14346.90636.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2009-10-26 21:03 ` [PATCH 1/2] mount.nfs: Assume v2/v3 if mount-related options are present Chuck Lever
[not found] ` <20091026210319.14346.20494.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2009-11-03 17:55 ` Steve Dickson
2009-10-26 21:03 ` [PATCH 2/2] mount: Fix po_join() call site in nfs_try_mount_v4() Chuck Lever
[not found] ` <20091026210327.14346.15937.stgit-RytpoXr2tKZ9HhUboXbp9zCvJB+x5qRC@public.gmane.org>
2009-11-03 17:56 ` Steve Dickson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox