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: Pavel Emelyanov <xemul@parallels.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v2 9/13] sunrpc: Merge the xs_bind code
Date: Tue, 19 Oct 2010 11:20:25 -0400	[thread overview]
Message-ID: <20101019152025.GB16742@fieldses.org> (raw)
In-Reply-To: <3E07FB7E-0697-409E-B51E-A3B310F7B065@oracle.com>

On Tue, Oct 19, 2010 at 10:35:51AM -0400, Chuck Lever wrote:
> 
> On Oct 18, 2010, at 7:55 PM, J. Bruce Fields wrote:
> 
> > On Mon, Oct 18, 2010 at 06:37:01PM -0400, Chuck Lever wrote:
> >> 
> >> The calling convention for rpc_create() allows this.  Notice in xs_setup_xprt() the source address is copied only if the args->srcaddr pointer is not NULL.  If it _is_ NULL, then the sock_xprt's srcaddr field should be filled with all zeros (which is the ANYADDR in both IPv4 and IPv6) because we allocate the new sock_xprt structure via kzalloc().  But the sa_family field is left zero as well in this case.
> >> 
> >> This is where the actual bug is, I think.  When srcaddr is NULL, instead of leaving that srcaddr field uninitialized in xs_setup_xprt(), it should plant an appropriate ANYADDR address there.  The family of that ANYADDR address is determined by the family of dstaddr, which is always initialized before this function is called.  I can send you a simple example patch that might apply before Pavel's work, if you like.
> >> 
> >> In the current code, the fact that ANYADDR just happens to be all zeroes saved our ass on this one.
> > 
> > It sounds like you're saying that before we ensured that fields other
> > tha .sin_family were zero in one way (with the automatic initialiation
> > of myaddr above), and now ensure it in another (kzalloc of the thing we
> > copy from)--I'm not sure the difference is as important as all that?
> 
> When the ULPs did not provide a source address, we've always used a zeroed out sockaddr.  That's marginally incorrect, but since ANYADDR is all zeroes, functionally it doesn't matter.  Formerly xs_bind?() copied only the address part (not the family or the port) when building the bind address.  With Pavel's changes it's copying more than just the address field in the source address.
> 
> All I'm saying is that the transport's source address should always be fully initialized (family included) at xprt setup time.
> 
> > But, honestly, I'm not following all this--I'll happily take whatever
> > revision you and Pavel want to give me, either incremental or as a
> > replacement for the 17 patches.
> 
> It's a minor change.  I can send you something later today to try.

OK, thanks.  I think it'll be easiest to proceed if I just go ahead and
commit what we've got so far; so I've just pushed out Pavel's stuff to

	git://linux-nfs.org/~bfields/linux.git for-2.6.37

Incremental patches on top of that welcomed.

--b.

  reply	other threads:[~2010-10-19 15:20 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-04 12:50 [PATCH 0/13] sunrpc: Compact the xprtsock code a bit Pavel Emelyanov
2010-10-04 12:51 ` [PATCH 1/13] sunrpc: Remove unused sock arg from xs_get_srcport Pavel Emelyanov
2010-10-04 12:51 ` [PATCH 2/13] sunrpc: Remove unused sock arg from xs_next_srcport Pavel Emelyanov
2010-10-04 12:52 ` [PATCH 3/13] sunrpc: Get xprt pointer once in xs_tcp_setup_socket Pavel Emelyanov
2010-10-04 12:52 ` [PATCH 4/13] sunrpc: Remove duplicate xprt/transport arguments from calls Pavel Emelyanov
2010-10-04 12:53 ` [PATCH 5/13] sunrpc: Factor out udp sockets creation Pavel Emelyanov
2010-10-04 12:54 ` [PATCH 6/13] sunrpc: Factor out v4 " Pavel Emelyanov
2010-10-04 12:54 ` [PATCH 7/13] sunrpc: Factor out v6 " Pavel Emelyanov
2010-10-04 12:55 ` [PATCH 8/13] sunrpc: Call xs_create_sockX directly from setup_socket Pavel Emelyanov
2010-10-04 12:56 ` [PATCH 9/13] sunrpc: Merge the xs_bind code Pavel Emelyanov
2010-10-05  3:20   ` Chuck Lever
2010-10-05  5:42     ` Pavel Emelyanov
2010-10-05 11:53       ` [PATCH v2 " Pavel Emelyanov
2010-10-06  3:04         ` Chuck Lever
2010-10-15 16:05         ` J. Bruce Fields
2010-10-15 16:24           ` Pavel Emelyanov
2010-10-15 16:39           ` Chuck Lever
2010-10-15 18:08             ` J. Bruce Fields
2010-10-15 18:09               ` J. Bruce Fields
2010-10-15 18:11               ` Chuck Lever
2010-10-18 21:15                 ` J. Bruce Fields
2010-10-18 21:43                   ` J. Bruce Fields
2010-10-18 21:53                     ` Chuck Lever
2010-10-18 21:57                       ` J. Bruce Fields
2010-10-18 22:37                         ` Chuck Lever
2010-10-18 23:55                           ` J. Bruce Fields
2010-10-19 14:35                             ` Chuck Lever
2010-10-19 15:20                               ` J. Bruce Fields [this message]
2010-10-20  9:19                                 ` Pavel Emelyanov
2010-10-04 12:56 ` [PATCH 10/13] sunrpc: Merge xs_create_sock code Pavel Emelyanov
2010-10-04 12:57 ` [PATCH 11/13] sunrpc: Pass family to setup_socket calls Pavel Emelyanov
2010-10-04 12:57 ` [PATCH 12/13] sunrpc: Remove TCP worker wrappers Pavel Emelyanov
2010-10-04 12:58 ` [PATCH 13/13] sunrpc: Remove UDP " Pavel Emelyanov
2010-10-11 23:47 ` [PATCH 0/13] sunrpc: Compact the xprtsock code a bit J. Bruce Fields
2010-10-12  7:51   ` Pavel Emelyanov
2010-10-12 13:50     ` J. Bruce Fields
2010-10-12 15:21       ` Pavel Emelyanov
2010-10-15 15:03         ` J. Bruce Fields

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=20101019152025.GB16742@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@Oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=xemul@parallels.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).