public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@redhat.com>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org, steved@redhat.com, trond.myklebust@fys.uio.no
Subject: Re: [PATCH] mount.nfs: prefer IPv4 addresses over IPv6 (try #2)
Date: Wed, 20 Jan 2010 11:34:22 -0500	[thread overview]
Message-ID: <20100120113422.6071bfbd@tlielax.poochiereds.net> (raw)
In-Reply-To: <8E556CE2-569B-4E6D-BD02-7EF5CA84900D@oracle.com>

On Wed, 20 Jan 2010 10:36:36 -0500
Chuck Lever <chuck.lever@oracle.com> wrote:

> 
> On Jan 20, 2010, at 8:29 AM, Jeff Layton wrote:
> 
> > On Tue, 19 Jan 2010 10:43:34 -0500
> > Chuck Lever <chuck.lever@oracle.com> wrote:
> >
> >>
> >> On Jan 19, 2010, at 8:27 AM, Jeff Layton wrote:
> >>
> >>> We're poised to enable IPv6 in nfs-utils in distros. There is a
> >>> potential problem however. mount.nfs will prefer IPv6 addrs.
> >>>
> >>> If someone has a working IPv4 server today that has an IPv6 address,
> >>> then clients may start trying to mount over that address. If the
> >>> server
> >>> doesn't support NFS serving over IPv6 (and virtually no linux  
> >>> servers
> >>> currently do), then the mount will start failing.
> >>>
> >>> Avoid this problem by making the mount code prefer IPv4 addresses
> >>> when they are available and an address family isn't specified.
> >>>
> >>> This is the second attempt at this patch. This moves the changes
> >>> into nfs_validate_options. Chuck also mentioned parameterizing this
> >>> behavior too. This patch doesn't include that, as I wasn't exactly
> >>> clear on what he had in mind.
> >>>
> >
> > After playing around with this some more, I'm coming to the conclusion
> > that my first patch for this (the one that modified nfs_lookup) is
> > really the best one.
> >
> > As Chuck pointed out, we need to have the address resolution behave
> > consistently, so I'd need to have other places that currently call
> > nfs_lookup do something similar.
> >
> > There are 4 callers of nfs_lookup currently:
> >
> > nfs_gethostbyname
> > nfs_umount_do_umnt
> > nfs_fix_mounthost_option
> > nfs_validate_options
> >
> > ...all of these with the exception of nfs_gethostbyname will need to  
> > do
> > this "sorting". nfs_gethostbyname passes in AF_INET for the family, so
> > it's guaranteed to return a IPv4 address or nothing anyway.
> >
> > I've tried a more-or-less exhaustive combination of proto=/mountproto=
> > options (and lack thereof) and I think with the original patch I  
> > posted
> > it works as expected.
> >
> > On IRC, Chuck mentioned replacing nfs_lookup with direct calls to
> > getaddrinfo, but that's a larger change and I don't really think it's
> > necessary.
> >
> > Chuck also suggested that we should have mount.nfs never attempt to  
> > use
> > an IPv6 address unless someone explicitly adds proto=tcp6|udp6. I'm  
> > not
> > a fan of that solution. I think if a hostname resolves to only an IPv6
> > address it ought to "just work" and mount via that address without
> > needing extra options.
> >
> > For discussion, the original patch follows:
> 
> For the record, we looked at Solaris behavior yesterday.  With bi- 
> family servers, its mount command tries IPv6 first, but appears smart  
> enough to fall back to IPv4.  One thing we haven't tried is to see how  
> difficult it would be to fix the real problem by adding proper  
> protocol family negotiation to our own mount command.  This patch is  
> predicated on the idea that would be hard to implement, which hasn't  
> been demonstrated.
> 
> I'm worried about putting this preference behavior in released code,  
> and then changing it yet again later.  I don't know how much time we  
> have to fix this, but if we have a few days, I could try implementing  
> real protocol family negotiation.
> 
> If you go forward with this solution, it should be made clear in the  
> documenting comments (and in the patch description) that this is a  
> temporary workaround.  If we intend to further correct this behavior  
> down the road, we should avoid building on the new behavior, even by  
> accident.
> 

Changing behavior is a valid concern and something we generally like to
avoid. OTOH, if someone doesn't specify proto=/mountproto= options
explicitly, then I think it's fair game to change the address
preference if we think it's reasonable and necessary.

I agree that doing proper negotiation would be ideal. I'll note that
with a 2.6.33-ish kernel, I quick -ECONNREFUSED errors when attempting
a NFSv4 mount to a server that doesn't support NFS over IPv6, so it
seems doable.

If you think you can get proper negotiation done within a few days,
then I say go for it and I'll hold off on asking Steve to take this
patch. If it turns out to be more difficult, we can always revisit this
patch.

-- 
Jeff Layton <jlayton@redhat.com>

  reply	other threads:[~2010-01-20 16:34 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19 13:27 [PATCH] mount.nfs: prefer IPv4 addresses over IPv6 (try #2) Jeff Layton
2010-01-19 15:43 ` Chuck Lever
2010-01-19 20:38   ` Jeff Layton
     [not found]     ` <20100119153826.67dd97a5-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-01-19 20:51       ` Trond Myklebust
2010-01-19 21:06         ` Chuck Lever
2010-01-20 13:13         ` Jeff Layton
2010-01-20 13:29   ` Jeff Layton
2010-01-20 15:36     ` Chuck Lever
2010-01-20 16:34       ` Jeff Layton [this message]
     [not found]         ` <20100120113422.6071bfbd-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-01-20 19:09           ` Chuck Lever
2010-01-21 19:15       ` J. Bruce Fields
2010-01-21 19:37         ` Chuck Lever
2010-01-21 19:57           ` J. Bruce Fields
2010-01-21 20:28             ` Chuck Lever
2010-01-21 21:52               ` J. Bruce Fields
2010-01-23 12:54 ` NFS/IPv6 servers on GNU/Linux? Ivan Shmakov
     [not found]   ` <87y6jp56cw.fsf-Hr8DDCuc/255On46OghOUKxOck334EZe@public.gmane.org>
2010-01-23 14:30     ` Jeff Layton

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=20100120113422.6071bfbd@tlielax.poochiereds.net \
    --to=jlayton@redhat.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    --cc=trond.myklebust@fys.uio.no \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox