Linux NFS development
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Chuck Lever <chuck.lever@oracle.com>, linux-nfs@vger.kernel.org
Subject: Re: [RFC,PATCH] svc: Modify svc_xprt_create to take a sockaddr
Date: Mon, 21 Jan 2008 13:15:24 -0600	[thread overview]
Message-ID: <1200942924.11003.58.camel@trinity.ogc.int> (raw)
In-Reply-To: <20080121183557.GK17468@fieldses.org>


On Mon, 2008-01-21 at 13:35 -0500, J. Bruce Fields wrote:
> On Mon, Jan 21, 2008 at 12:47:08PM -0500, Chuck Lever wrote:
> > Hi Tom-
> >
> > On Jan 21, 2008, at 12:11 PM, Tom Tucker wrote:
> >> Modify the svc_create_xprt function to take a sockaddr instead of just
> >> a port. This approach allows a single transport class,
> >> "tcp" for example, to support both IPv4 and IPv6 connections since
> >> this information is now provided in the sockaddr when the endpoint
> >> is created.  This also allows RPC servers to create listening  
> >> endpoints
> >> on a specific interface.
> >
> > I assume this goes along with the server-side rpcb_register_v3 patches I 
> > proposed last week?
> >
> >> Also modify the svc_xprt_find function to search based on sockaddr so
> >> interface specific endpoints can be searched for.
> >>
> >> Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
> >> ---
> >>
> >>  fs/lockd/svc.c                  |   16 +++--
> >>  fs/nfs/callback.c               |    8 ++
> >>  fs/nfsd/nfsctl.c                |  135 ++++++++++++++++++++++++++++ 
> >> +----------
> >>  fs/nfsd/nfssvc.c                |   11 +++
> >>  include/linux/sunrpc/svc_xprt.h |    4 +
> >>  net/sunrpc/svc_xprt.c           |   96 ++++++++++++++++++++++------
> >>  6 files changed, 206 insertions(+), 64 deletions(-)
> >>
> >> diff --git a/fs/lockd/svc.c b/fs/lockd/svc.c
> >> index 0822646..89e40fb 100644
> >> --- a/fs/lockd/svc.c
> >> +++ b/fs/lockd/svc.c
> >> @@ -229,19 +229,27 @@ static int make_socks(struct svc_serv *serv, int 
> >> proto)
> >>  	static int warned;
> >>  	struct svc_xprt *xprt;
> >>  	int err = 0;
> >> +	struct sockaddr_in sin = {
> >> +		.sin_family = AF_INET,
> >> +		.sin_addr = { INADDR_ANY }
> >> +	};
> >>
> >>  	if (proto == IPPROTO_UDP || nlm_udpport) {
> >> -		xprt = svc_find_xprt(serv, "udp", 0, 0);
> >> +		sin.sin_port = htons(nlm_udpport);
> >> +		xprt = svc_find_xprt(serv, "udp", NULL);
> >>  		if (!xprt)
> >> -			err = svc_create_xprt(serv, "udp", nlm_udpport,
> >> +			err = svc_create_xprt(serv, "udp",
> >> +					      (struct sockaddr *)&sin,
> >>  					      SVC_SOCK_DEFAULTS);
> >>  		else
> >>  			svc_xprt_put(xprt);
> >>  	}
> >>  	if (err >= 0 && (proto == IPPROTO_TCP || nlm_tcpport)) {
> >> -		xprt = svc_find_xprt(serv, "tcp", 0, 0);
> >> +		sin.sin_port = htons(nlm_tcpport);
> >> +		xprt = svc_find_xprt(serv, "tcp", NULL);
> >>  		if (!xprt)
> >> -			err = svc_create_xprt(serv, "tcp", nlm_tcpport,
> >> +			err = svc_create_xprt(serv, "tcp",
> >> +					      (struct sockaddr *)&sin,
> >>  					      SVC_SOCK_DEFAULTS);
> >>  		else
> >>  			svc_xprt_put(xprt);
> >
> > This is sort of a generic question.
> >
> > The server-side interface appears to be using strings to identify  
> > transports ("tcp"), but the client-side is still using numbers  
> > (XPRT_TRANSPORT_TCP).  There are one or two sticky issues to fix before 
> > the client-side can use strings, but...
> >
> > Should the server-side use netids instead of arbitrary strings?  I guess 
> > that would be a little awkward because you'd need to use "udp6" for UDP 
> > on IPv6, and so on.
> >
> > In any event, should we use macros for these instead of open-coded  
> > strings?
> 
> If you're proposing something like
> 
> 	#define TCP "tcp"
> 
> I think that's unnecessary obfuscation.

I think the idea was that these strings may change when we normalize the
client and server side, so placing them in a header where they could be
shared might be a good thing.

The name would likely be something like SVC_TCP_CLASS or something. If
we don't ever do that, then yes ... it just obfuscation.

> 
> --b.
> -
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


      reply	other threads:[~2008-01-21 19:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-21 17:11 [RFC,PATCH] svc: Modify svc_xprt_create to take a sockaddr Tom Tucker
     [not found] ` <20080121171105.29028.61809.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2008-01-21 17:47   ` Chuck Lever
2008-01-21 17:59     ` Trond Myklebust
     [not found]       ` <1200938366.25562.14.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-21 18:22         ` Tom Tucker
2008-01-21 18:30         ` Chuck Lever
2008-01-21 19:24           ` Trond Myklebust
     [not found]             ` <1200943495.25562.52.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-21 20:48               ` Tom Tucker
     [not found]                 ` <1200948494.11003.71.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2008-01-21 22:42                   ` Trond Myklebust
     [not found]                     ` <1200955371.27963.28.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2008-01-22 17:52                       ` Chuck Lever
2008-01-21 18:21     ` Tom Tucker
2008-01-21 18:35     ` J. Bruce Fields
2008-01-21 19:15       ` Tom Tucker [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=1200942924.11003.58.camel@trinity.ogc.int \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=chuck.lever@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox