All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: andros@netapp.com
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 2/2] NFS add multiaddr mount option
Date: Wed, 16 Mar 2016 11:24:38 -0400	[thread overview]
Message-ID: <56E97AB6.6030209@RedHat.com> (raw)
In-Reply-To: <1456336559-17334-3-git-send-email-andros@netapp.com>

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;
>  }
>  
> 

      reply	other threads:[~2016-03-16 15:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56E97AB6.6030209@RedHat.com \
    --to=steved@redhat.com \
    --cc=andros@netapp.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.