* [PATCH 0/2] Add multihostname support for NFSv4.1,2 @ 2016-02-24 17:55 andros 2016-02-24 17:55 ` [PATCH 1/2] NFS parse NFSv4 multiple hostnames andros 2016-02-24 17:55 ` [PATCH 2/2] NFS add multiaddr mount option andros 0 siblings, 2 replies; 6+ messages in thread From: andros @ 2016-02-24 17:55 UTC (permalink / raw) To: steved; +Cc: linux-nfs, Andy Adamson From: Andy Adamson <andros@netapp.com> This code requires the kernel "Version 2 NFSV4.1,2 session trunking" patch set. Note that while being useful for testing, it is not yet decided if expressing session trunking hosts in this manner is the best way forward. Andy Adamson (2): NFS parse NFSv4 multiple hostnames NFS add multiaddr mount option utils/mount/parse_dev.c | 30 ++++++++++++++++-------- utils/mount/parse_dev.h | 2 +- utils/mount/stropts.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++- utils/mount/utils.c | 2 +- 4 files changed, 83 insertions(+), 13 deletions(-) -- 1.8.3.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] NFS parse NFSv4 multiple hostnames 2016-02-24 17:55 [PATCH 0/2] Add multihostname support for NFSv4.1,2 andros @ 2016-02-24 17:55 ` andros 2016-03-16 15:26 ` Steve Dickson 2016-02-24 17:55 ` [PATCH 2/2] NFS add multiaddr mount option andros 1 sibling, 1 reply; 6+ messages in thread From: andros @ 2016-02-24 17:55 UTC (permalink / raw) To: steved; +Cc: linux-nfs, Andy Adamson From: Andy Adamson <andros@netapp.com> For NFSv4.x mounts Signed-off-by: Andy Adamson <andros@netapp.com> --- utils/mount/parse_dev.c | 30 ++++++++++++++++++++---------- utils/mount/parse_dev.h | 2 +- utils/mount/stropts.c | 3 ++- utils/mount/utils.c | 2 +- 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c index 0d3bcb9..c5d2215 100644 --- a/utils/mount/parse_dev.c +++ b/utils/mount/parse_dev.c @@ -79,10 +79,10 @@ static int nfs_pdn_missing_brace_err(void) /* * Standard hostname:path format */ -static int nfs_parse_simple_hostname(const char *dev, - char **hostname, char **pathname) +static int nfs_parse_simple_hostname(const char *dev, char **hostname, + char **multinames, char **pathname) { - size_t host_len, path_len; + size_t host_len, multi_len = 0, path_len; char *colon, *comma; /* Must have a colon */ @@ -96,13 +96,15 @@ static int nfs_parse_simple_hostname(const char *dev, return nfs_pdn_hostname_too_long_err(); /* If there's a comma before the colon, take only the - * first name in list */ + * first name in list as the hostname, the rest get stored in + * the multinames. Note that NFS_MAXHOSTNAME limits the number + * of multinames */ comma = strchr(dev, ','); if (comma != NULL) { *comma = '\0'; host_len = comma - dev; - nfs_error(_("%s: warning: multiple hostnames not supported"), - progname); + comma++; + multi_len = colon - comma; } else colon++; @@ -115,6 +117,11 @@ static int nfs_parse_simple_hostname(const char *dev, if (*hostname == NULL) return nfs_pdn_nomem_err(); } + if (multinames && multi_len != 0) { + *multinames = strndup(comma, multi_len); + if (*multinames == NULL) + return nfs_pdn_nomem_err(); + } if (pathname) { *pathname = strndup(colon, path_len); if (*pathname == NULL) { @@ -196,11 +203,13 @@ static int nfs_parse_nfs_url(__attribute__((unused)) const char *dev, * nfs_parse_devname - Determine the server's hostname by looking at "devname". * @devname: pointer to mounted device name (first argument of mount command) * @hostname: OUT: pointer to server's hostname + * @multinames: OUT: pointer to comma separated multiple server interface names * @pathname: OUT: pointer to export path on server * * Returns 1 if succesful, or zero if some error occurred. On success, - * @hostname and @pathname point to dynamically allocated buffers containing - * the hostname of the server and the export pathname (both '\0'-terminated). + * @hostname, @multinames, and @pathname point to dynamically allocated + * buffers containing the hostname of the server, other multiple server + * interfaces, and the export pathname (all '\0'-terminated). * * @hostname or @pathname may be NULL if caller doesn't want a copy of those * parts of @devname. @@ -208,7 +217,7 @@ static int nfs_parse_nfs_url(__attribute__((unused)) const char *dev, * Note that this will not work if @devname is a wide-character string. */ int nfs_parse_devname(const char *devname, - char **hostname, char **pathname) + char **hostname, char **multinames, char **pathname) { char *dev; int result; @@ -225,7 +234,8 @@ int nfs_parse_devname(const char *devname, else if (strncmp(dev, "nfs://", 6) == 0) result = nfs_parse_nfs_url(dev, hostname, pathname); else - result = nfs_parse_simple_hostname(dev, hostname, pathname); + result = nfs_parse_simple_hostname(dev, hostname, multinames, + pathname); free(dev); return result; diff --git a/utils/mount/parse_dev.h b/utils/mount/parse_dev.h index f9857bc..ef663f8 100644 --- a/utils/mount/parse_dev.h +++ b/utils/mount/parse_dev.h @@ -23,6 +23,6 @@ #ifndef __NFS_UTILS_PARSE_DEV_HEADER #define __NFS_UTILS_PARSE_DEV_HEADER -extern int nfs_parse_devname(const char *, char **, char **); +extern int nfs_parse_devname(const char *, char **, char **, char **); #endif /* __NFS_UTILS_PARSE_DEV */ diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 86829a9..75646f6 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -83,6 +83,7 @@ struct nfsmount_info { *node, /* mounted-on dir */ *type; /* "nfs" or "nfs4" */ char *hostname; /* server's hostname */ + char *multinames; /* more server interfaces */ struct addrinfo *address; /* server's addresses */ struct mount_options *options; /* parsed mount options */ @@ -377,7 +378,7 @@ static int nfs_validate_options(struct nfsmount_info *mi) sa_family_t family; int error; - if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL)) + if (!nfs_parse_devname(mi->spec, &mi->hostname, &mi->multinames, NULL)) return 0; if (!nfs_nfs_proto_family(mi->options, &family)) diff --git a/utils/mount/utils.c b/utils/mount/utils.c index 92662ed..2b6ee74 100644 --- a/utils/mount/utils.c +++ b/utils/mount/utils.c @@ -159,7 +159,7 @@ int nfs_umount23(const char *devname, char *string) struct mount_options *options; int result = EX_FAIL; - if (!nfs_parse_devname(devname, &hostname, &dirname)) + if (!nfs_parse_devname(devname, &hostname, NULL, &dirname)) return EX_USAGE; options = po_split(string); -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] NFS parse NFSv4 multiple hostnames 2016-02-24 17:55 ` [PATCH 1/2] NFS parse NFSv4 multiple hostnames andros @ 2016-03-16 15:26 ` Steve Dickson 2016-04-20 14:39 ` Adamson, Andy 0 siblings, 1 reply; 6+ messages in thread From: Steve Dickson @ 2016-03-16 15:26 UTC (permalink / raw) To: andros; +Cc: linux-nfs On 02/24/2016 12:55 PM, andros@netapp.com wrote: > From: Andy Adamson <andros@netapp.com> > > For NFSv4.x mounts > > Signed-off-by: Andy Adamson <andros@netapp.com> > --- > utils/mount/parse_dev.c | 30 ++++++++++++++++++++---------- > utils/mount/parse_dev.h | 2 +- > utils/mount/stropts.c | 3 ++- > utils/mount/utils.c | 2 +- > 4 files changed, 24 insertions(+), 13 deletions(-) > > diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c > index 0d3bcb9..c5d2215 100644 > --- a/utils/mount/parse_dev.c > +++ b/utils/mount/parse_dev.c > @@ -79,10 +79,10 @@ static int nfs_pdn_missing_brace_err(void) > /* > * Standard hostname:path format > */ > -static int nfs_parse_simple_hostname(const char *dev, > - char **hostname, char **pathname) > +static int nfs_parse_simple_hostname(const char *dev, char **hostname, > + char **multinames, char **pathname) > { > - size_t host_len, path_len; > + size_t host_len, multi_len = 0, path_len; > char *colon, *comma; > > /* Must have a colon */ > @@ -96,13 +96,15 @@ static int nfs_parse_simple_hostname(const char *dev, > return nfs_pdn_hostname_too_long_err(); > > /* If there's a comma before the colon, take only the > - * first name in list */ > + * first name in list as the hostname, the rest get stored in > + * the multinames. Note that NFS_MAXHOSTNAME limits the number > + * of multinames */ > comma = strchr(dev, ','); > if (comma != NULL) { > *comma = '\0'; > host_len = comma - dev; > - nfs_error(_("%s: warning: multiple hostnames not supported"), > - progname); > + comma++; > + multi_len = colon - comma; > } else > > colon++; > @@ -115,6 +117,11 @@ static int nfs_parse_simple_hostname(const char *dev, > if (*hostname == NULL) > return nfs_pdn_nomem_err(); > } > + if (multinames && multi_len != 0) { > + *multinames = strndup(comma, multi_len); > + if (*multinames == NULL) > + return nfs_pdn_nomem_err(); > + } > if (pathname) { > *pathname = strndup(colon, path_len); > if (*pathname == NULL) { > @@ -196,11 +203,13 @@ static int nfs_parse_nfs_url(__attribute__((unused)) const char *dev, > * nfs_parse_devname - Determine the server's hostname by looking at "devname". > * @devname: pointer to mounted device name (first argument of mount command) > * @hostname: OUT: pointer to server's hostname > + * @multinames: OUT: pointer to comma separated multiple server interface names > * @pathname: OUT: pointer to export path on server > * > * Returns 1 if succesful, or zero if some error occurred. On success, > - * @hostname and @pathname point to dynamically allocated buffers containing > - * the hostname of the server and the export pathname (both '\0'-terminated). > + * @hostname, @multinames, and @pathname point to dynamically allocated > + * buffers containing the hostname of the server, other multiple server > + * interfaces, and the export pathname (all '\0'-terminated). > * > * @hostname or @pathname may be NULL if caller doesn't want a copy of those > * parts of @devname. > @@ -208,7 +217,7 @@ static int nfs_parse_nfs_url(__attribute__((unused)) const char *dev, > * Note that this will not work if @devname is a wide-character string. > */ > int nfs_parse_devname(const char *devname, > - char **hostname, char **pathname) > + char **hostname, char **multinames, char **pathname) > { > char *dev; > int result; > @@ -225,7 +234,8 @@ int nfs_parse_devname(const char *devname, > else if (strncmp(dev, "nfs://", 6) == 0) > result = nfs_parse_nfs_url(dev, hostname, pathname); > else > - result = nfs_parse_simple_hostname(dev, hostname, pathname); > + result = nfs_parse_simple_hostname(dev, hostname, multinames, > + pathname); > > free(dev); > return result; > diff --git a/utils/mount/parse_dev.h b/utils/mount/parse_dev.h > index f9857bc..ef663f8 100644 > --- a/utils/mount/parse_dev.h > +++ b/utils/mount/parse_dev.h > @@ -23,6 +23,6 @@ > #ifndef __NFS_UTILS_PARSE_DEV_HEADER > #define __NFS_UTILS_PARSE_DEV_HEADER > > -extern int nfs_parse_devname(const char *, char **, char **); > +extern int nfs_parse_devname(const char *, char **, char **, char **); > > #endif /* __NFS_UTILS_PARSE_DEV */ > diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c > index 86829a9..75646f6 100644 > --- a/utils/mount/stropts.c > +++ b/utils/mount/stropts.c > @@ -83,6 +83,7 @@ struct nfsmount_info { > *node, /* mounted-on dir */ > *type; /* "nfs" or "nfs4" */ > char *hostname; /* server's hostname */ > + char *multinames; /* more server interfaces */ > struct addrinfo *address; /* server's addresses */ > > struct mount_options *options; /* parsed mount options */ > @@ -377,7 +378,7 @@ static int nfs_validate_options(struct nfsmount_info *mi) > sa_family_t family; > int error; > > - if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL)) > + if (!nfs_parse_devname(mi->spec, &mi->hostname, &mi->multinames, NULL)) > return 0; > > if (!nfs_nfs_proto_family(mi->options, &family)) I understand how multinames is allocated, which looks fine, but I don't see how its used... What am I missing? steved. > diff --git a/utils/mount/utils.c b/utils/mount/utils.c > index 92662ed..2b6ee74 100644 > --- a/utils/mount/utils.c > +++ b/utils/mount/utils.c > @@ -159,7 +159,7 @@ int nfs_umount23(const char *devname, char *string) > struct mount_options *options; > int result = EX_FAIL; > > - if (!nfs_parse_devname(devname, &hostname, &dirname)) > + if (!nfs_parse_devname(devname, &hostname, NULL, &dirname)) > return EX_USAGE; > > options = po_split(string); > ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] NFS parse NFSv4 multiple hostnames 2016-03-16 15:26 ` Steve Dickson @ 2016-04-20 14:39 ` Adamson, Andy 0 siblings, 0 replies; 6+ messages in thread From: Adamson, Andy @ 2016-04-20 14:39 UTC (permalink / raw) To: Steve Dickson; +Cc: linux-nfs@vger.kernel.org ________________________________________ From: Steve Dickson <SteveD@redhat.com> Sent: Wednesday, March 16, 2016 11:26 AM To: Adamson, Andy Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH 1/2] NFS parse NFSv4 multiple hostnames On 02/24/2016 12:55 PM, andros@netapp.com wrote: > From: Andy Adamson <andros@netapp.com> > > For NFSv4.x mounts > > Signed-off-by: Andy Adamson <andros@netapp.com> > --- > utils/mount/parse_dev.c | 30 ++++++++++++++++++++---------- > utils/mount/parse_dev.h | 2 +- > utils/mount/stropts.c | 3 ++- > utils/mount/utils.c | 2 +- > 4 files changed, 24 insertions(+), 13 deletions(-) > > diff --git a/utils/mount/parse_dev.c b/utils/mount/parse_dev.c > index 0d3bcb9..c5d2215 100644 > --- a/utils/mount/parse_dev.c > +++ b/utils/mount/parse_dev.c > @@ -79,10 +79,10 @@ static int nfs_pdn_missing_brace_err(void) > /* > * Standard hostname:path format > */ > -static int nfs_parse_simple_hostname(const char *dev, > - char **hostname, char **pathname) > +static int nfs_parse_simple_hostname(const char *dev, char **hostname, > + char **multinames, char **pathname) > { > - size_t host_len, path_len; > + size_t host_len, multi_len = 0, path_len; > char *colon, *comma; > > /* Must have a colon */ > @@ -96,13 +96,15 @@ static int nfs_parse_simple_hostname(const char *dev, > return nfs_pdn_hostname_too_long_err(); > > /* If there's a comma before the colon, take only the > - * first name in list */ > + * first name in list as the hostname, the rest get stored in > + * the multinames. Note that NFS_MAXHOSTNAME limits the number > + * of multinames */ > comma = strchr(dev, ','); > if (comma != NULL) { > *comma = '\0'; > host_len = comma - dev; > - nfs_error(_("%s: warning: multiple hostnames not supported"), > - progname); > + comma++; > + multi_len = colon - comma; > } else > > colon++; > @@ -115,6 +117,11 @@ static int nfs_parse_simple_hostname(const char *dev, > if (*hostname == NULL) > return nfs_pdn_nomem_err(); > } > + if (multinames && multi_len != 0) { > + *multinames = strndup(comma, multi_len); > + if (*multinames == NULL) > + return nfs_pdn_nomem_err(); > + } > if (pathname) { > *pathname = strndup(colon, path_len); > if (*pathname == NULL) { > @@ -196,11 +203,13 @@ static int nfs_parse_nfs_url(__attribute__((unused)) const char *dev, > * nfs_parse_devname - Determine the server's hostname by looking at "devname". > * @devname: pointer to mounted device name (first argument of mount command) > * @hostname: OUT: pointer to server's hostname > + * @multinames: OUT: pointer to comma separated multiple server interface names > * @pathname: OUT: pointer to export path on server > * > * Returns 1 if succesful, or zero if some error occurred. On success, > - * @hostname and @pathname point to dynamically allocated buffers containing > - * the hostname of the server and the export pathname (both '\0'-terminated). > + * @hostname, @multinames, and @pathname point to dynamically allocated > + * buffers containing the hostname of the server, other multiple server > + * interfaces, and the export pathname (all '\0'-terminated). > * > * @hostname or @pathname may be NULL if caller doesn't want a copy of those > * parts of @devname. > @@ -208,7 +217,7 @@ static int nfs_parse_nfs_url(__attribute__((unused)) const char *dev, > * Note that this will not work if @devname is a wide-character string. > */ > int nfs_parse_devname(const char *devname, > - char **hostname, char **pathname) > + char **hostname, char **multinames, char **pathname) > { > char *dev; > int result; > @@ -225,7 +234,8 @@ int nfs_parse_devname(const char *devname, > else if (strncmp(dev, "nfs://", 6) == 0) > result = nfs_parse_nfs_url(dev, hostname, pathname); > else > - result = nfs_parse_simple_hostname(dev, hostname, pathname); > + result = nfs_parse_simple_hostname(dev, hostname, multinames, > + pathname); > > free(dev); > return result; > diff --git a/utils/mount/parse_dev.h b/utils/mount/parse_dev.h > index f9857bc..ef663f8 100644 > --- a/utils/mount/parse_dev.h > +++ b/utils/mount/parse_dev.h > @@ -23,6 +23,6 @@ > #ifndef __NFS_UTILS_PARSE_DEV_HEADER > #define __NFS_UTILS_PARSE_DEV_HEADER > > -extern int nfs_parse_devname(const char *, char **, char **); > +extern int nfs_parse_devname(const char *, char **, char **, char **); > > #endif /* __NFS_UTILS_PARSE_DEV */ > diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c > index 86829a9..75646f6 100644 > --- a/utils/mount/stropts.c > +++ b/utils/mount/stropts.c > @@ -83,6 +83,7 @@ struct nfsmount_info { > *node, /* mounted-on dir */ > *type; /* "nfs" or "nfs4" */ > char *hostname; /* server's hostname */ > + char *multinames; /* more server interfaces */ > struct addrinfo *address; /* server's addresses */ > > struct mount_options *options; /* parsed mount options */ > @@ -377,7 +378,7 @@ static int nfs_validate_options(struct nfsmount_info *mi) > sa_family_t family; > int error; > > - if (!nfs_parse_devname(mi->spec, &mi->hostname, NULL)) > + if (!nfs_parse_devname(mi->spec, &mi->hostname, &mi->multinames, NULL)) > return 0; > > if (!nfs_nfs_proto_family(mi->options, &family)) I understand how multinames is allocated, which looks fine, but I don't see how its used... What am I missing? Hi Steve Sorry it took so long to respond. Back from leave of absence from left hip replacement! Anyway, I'll be reviving the sessions trunking effort. I'm continuing to test and will put out a new version of this patch set. Here is how the multinames is used: The nfsmount_info struct which now contains the multinames field, is passed to the kernel (and becomes nfs_parsed_mount_data) which consumes the multinames. -->Andy steved. > diff --git a/utils/mount/utils.c b/utils/mount/utils.c > index 92662ed..2b6ee74 100644 > --- a/utils/mount/utils.c > +++ b/utils/mount/utils.c > @@ -159,7 +159,7 @@ int nfs_umount23(const char *devname, char *string) > struct mount_options *options; > int result = EX_FAIL; > > - if (!nfs_parse_devname(devname, &hostname, &dirname)) > + if (!nfs_parse_devname(devname, &hostname, NULL, &dirname)) > return EX_USAGE; > > options = po_split(string); > ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] NFS add multiaddr mount option 2016-02-24 17:55 [PATCH 0/2] Add multihostname support for NFSv4.1,2 andros 2016-02-24 17:55 ` [PATCH 1/2] NFS parse NFSv4 multiple hostnames andros @ 2016-02-24 17:55 ` andros 2016-03-16 15:24 ` Steve Dickson 1 sibling, 1 reply; 6+ messages in thread From: andros @ 2016-02-24 17:55 UTC (permalink / raw) To: steved; +Cc: linux-nfs, Andy Adamson From: Andy Adamson <andros@netapp.com> Signed-off-by: Andy Adamson <andros@netapp.com> --- utils/mount/stropts.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 75646f6..041bbcd 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -365,6 +365,60 @@ static int nfs_set_version(struct nfsmount_info *mi) return 1; } +/** + * Returns 1 if multiaddr= opttion appended successfully + * otherwise zero + */ +static int +nfs_append_multiaddr_option(char *multinames, struct mount_options *options, + int family) +{ + struct addrinfo hint = { + .ai_protocol = (int)IPPROTO_UDP, + .ai_family = family, + }; + char *comma, *name; + struct addrinfo *temp; + int error, failed = 1; + + if (!multinames) + return 0; + + name = multinames; + comma = strchr(name, ','); + while (name != NULL) { + if (comma != NULL) + *comma = '\0'; + + error = getaddrinfo(name, NULL, &hint, &temp); + if (error != 0) { + nfs_error(_("%s: Failed to resolve server %s: %s"), + progname, name, gai_strerror(error)); + continue; + } + + if (!nfs_append_generic_address_option(temp->ai_addr, + temp->ai_addrlen, + "multiaddr", options)) { + nfs_error(_("%s: Failed to append multiaddr %s"), + progname, name); + continue; + } + failed = 0; + if (comma == NULL) + name = NULL; + else { + name = comma +1; + comma = strchr(name, ','); + } + } + + if (failed == 1) + return 0; + else + return 1; +} + /* * Set up mandatory non-version specific NFS mount options. * @@ -403,6 +457,11 @@ static int nfs_validate_options(struct nfsmount_info *mi) mi->address->ai_addrlen, mi->options)) return 0; + if ((mi->version.major == 4 && mi->version.minor > 0)) + if (!nfs_append_multiaddr_option(mi->multinames, mi->options, + family)) + return 0; + return 1; } -- 1.8.3.1 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] NFS add multiaddr mount option 2016-02-24 17:55 ` [PATCH 2/2] NFS add multiaddr mount option andros @ 2016-03-16 15:24 ` Steve Dickson 0 siblings, 0 replies; 6+ messages in thread From: Steve Dickson @ 2016-03-16 15:24 UTC (permalink / raw) To: andros; +Cc: linux-nfs Hey Andy, Sorry for the delay.... On 02/24/2016 12:55 PM, andros@netapp.com wrote: > From: Andy Adamson <andros@netapp.com> > > Signed-off-by: Andy Adamson <andros@netapp.com> Should there be an manpage update as well? steved. > --- > utils/mount/stropts.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 59 insertions(+) > > diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c > index 75646f6..041bbcd 100644 > --- a/utils/mount/stropts.c > +++ b/utils/mount/stropts.c > @@ -365,6 +365,60 @@ static int nfs_set_version(struct nfsmount_info *mi) > return 1; > } > > +/** > + * Returns 1 if multiaddr= opttion appended successfully > + * otherwise zero > + */ > +static int > +nfs_append_multiaddr_option(char *multinames, struct mount_options *options, > + int family) > +{ > + struct addrinfo hint = { > + .ai_protocol = (int)IPPROTO_UDP, > + .ai_family = family, > + }; > + char *comma, *name; > + struct addrinfo *temp; > + int error, failed = 1; > + > + if (!multinames) > + return 0; > + > + name = multinames; > + comma = strchr(name, ','); > + while (name != NULL) { > + if (comma != NULL) > + *comma = '\0'; > + > + error = getaddrinfo(name, NULL, &hint, &temp); > + if (error != 0) { > + nfs_error(_("%s: Failed to resolve server %s: %s"), > + progname, name, gai_strerror(error)); > + continue; > + } > + > + if (!nfs_append_generic_address_option(temp->ai_addr, > + temp->ai_addrlen, > + "multiaddr", options)) { > + nfs_error(_("%s: Failed to append multiaddr %s"), > + progname, name); > + continue; > + } > + failed = 0; > + if (comma == NULL) > + name = NULL; > + else { > + name = comma +1; > + comma = strchr(name, ','); > + } > + } > + > + if (failed == 1) > + return 0; > + else > + return 1; > +} > + > /* > * Set up mandatory non-version specific NFS mount options. > * > @@ -403,6 +457,11 @@ static int nfs_validate_options(struct nfsmount_info *mi) > mi->address->ai_addrlen, mi->options)) > return 0; > > + if ((mi->version.major == 4 && mi->version.minor > 0)) > + if (!nfs_append_multiaddr_option(mi->multinames, mi->options, > + family)) > + return 0; > + > return 1; > } > > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-04-20 14:39 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-02-24 17:55 [PATCH 0/2] Add multihostname support for NFSv4.1,2 andros 2016-02-24 17:55 ` [PATCH 1/2] NFS parse NFSv4 multiple hostnames andros 2016-03-16 15:26 ` Steve Dickson 2016-04-20 14:39 ` Adamson, Andy 2016-02-24 17:55 ` [PATCH 2/2] NFS add multiaddr mount option andros 2016-03-16 15:24 ` 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).