linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: Takuma Umeya <tumeya@redhat.com>,
	linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nfs4: set source address when callback is generated
Date: Tue, 11 Jan 2011 10:09:19 -0500	[thread overview]
Message-ID: <20110111150919.GB15603@fieldses.org> (raw)
In-Reply-To: <3443745A-607D-4FD8-BA93-622669A09EAF@oracle.com>

On Wed, Jan 05, 2011 at 12:18:37PM -0500, Chuck Lever wrote:
> 
> On Jan 5, 2011, at 12:11 PM, J. Bruce Fields wrote:
> 
> > On Wed, Jan 05, 2011 at 12:06:04PM -0500, Chuck Lever wrote:
> >> 
> >> On Jan 4, 2011, at 7:58 PM, J. Bruce Fields wrote:
> >> 
> >>> On Thu, Dec 16, 2010 at 10:54:00AM -0500, Chuck Lever wrote:
> >>>> I don't recall creating svc_addr_u, but I'll take a stab at a
> >>>> guess.
> >>>> 
> >>>> It looks like someone thought that we should retain the idea of
> >>>> storing just the address part of the socket address, and not the
> >>>> other stuff (like the family and port, since this code doesn't
> >>>> appear to need that additional information).  It greatly reduces
> >>>> the size of the field.  A full sockaddr_storage is more than 128
> >>>> bytes, since it has to be able to store an AF_UNIX pathname.
> >>>> 
> >>>> Doing this, there is a lot less data to keep around, but an IPv6
> >>>> socket address has other items outside of in6_addr that can be
> >>>> used to form a full address.  We decided at some point we could
> >>>> copy this information from the other address storage field in the
> >>>> rqstp.
> >>>> 
> >>>> But the result of this space savings means we must construct a
> >>>> full socket address when needed, using logic such as the above.
> >>> 
> >>> Seems to me we should either just waste the extra 100 bytes or
> >>> define something that would be useful elsewhere as well....
> >> 
> >> In nfs-utils, we define:
> >> 
> >> 	union nfs_sockaddr { struct sockaddr_in	s4; struct sockaddr_in6
> >> 	s6; struct sockaddr		sa; };
> >> 
> >> A variable of this type is large enough to hold a full IPv6
> >> sockaddr, but is significantly smaller than a sockaddr_storage.
> >> 
> >> The addition of the "struct sockaddr" element is to enable access
> >> to such variables via a "struct sockaddr *" without type punning.
> >> This seems to be preferred by gcc over type casting in order to
> >> handle optimizations involving address aliasing.  It also allows
> >> more precise type checking.
> > 
> > Sounds reasonable to me.
> > 
> >> 
> >> A full conversion to use such a construct in kernel RPC and NFS
> >> components is, I fear, too late for 2.6.38, but might be considered
> >> for a future release if there is consensus on this approach.
> > 
> > OK; I suppose for now I'll apply my revision of Takuma Umeya's patch
> > below (if I didn't screw it up).
> 
> My thinking cap is still on vacation.  I don't see anything
> immediately wrong with this as a temporary fix.  Has anyone tested
> this with a multi-homed IPv6 server?  How about link-local IPv6
> addresses?

I believe the original patch was tested with a multi-homed server, but
probably just IPv4.  It would be useful to retest to make sure I didn't
introduce a typo on cleanup (my version is pushed to
git://linux-nfs.org/~bfields/linux.git for-2.6.38 now).  And, yes, the
IPv6 cases would be good to test as well.

--b.

      reply	other threads:[~2011-01-11 15:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15  5:09 [PATCH] nfs4: set source address when callback is generated Takuma Umeya
2010-12-16  3:49 ` J. Bruce Fields
2010-12-16 15:54   ` Chuck Lever
2011-01-05  0:58     ` J. Bruce Fields
2011-01-05 17:06       ` Chuck Lever
2011-01-05 17:11         ` J. Bruce Fields
2011-01-05 17:18           ` Chuck Lever
2011-01-11 15:09             ` J. Bruce Fields [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=20110111150919.GB15603@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tumeya@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).