Linux NFS development
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: neilb@suse.de, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 38/38] svc: Add svc_xprt_names service to replace svc_sock_names
Date: Fri, 21 Dec 2007 11:51:47 -0600	[thread overview]
Message-ID: <1198259507.14237.31.camel@trinity.ogc.int> (raw)
In-Reply-To: <20071215000328.GP23121@fieldses.org>


On Fri, 2007-12-14 at 19:03 -0500, J. Bruce Fields wrote:
> On Tue, Dec 11, 2007 at 05:33:18PM -0600, Tom Tucker wrote:
> > 
> > Create a transport independent version of the svc_sock_names function.
> > 
> > The toclose capability of the svc_sock_names service can be implemented
> > using the svc_xprt_find and svc_xprt_close services.
> 
> Should we delete the toclose checks from svc_sock_names(), then, under
> the assumption it's always called with toclose non-NULL now?
> 
> And why can't we just completely replace svc_sock_names() at this point?
> 

IMO we could, but there is currently a difference in behavior between
svc_sock_names and svc_find_xprt/close. svc_find_xprt doesn't care what
the IP address is, it only compares transport name, address family and
port. 

Presently in NFS, we only ever listen on zero, but you can destroy an
endpoint on a particular interface (IP address). Can anyone shed some
light on why this is? 

> --b.
> 
> > 
> > Signed-off-by: Tom Tucker <tom@opengridcomputing.com>
> > ---
> > 
> >  fs/nfsd/nfsctl.c                |    2 +-
> >  include/linux/sunrpc/svc_xprt.h |    1 +
> >  net/sunrpc/svc_xprt.c           |   35 +++++++++++++++++++++++++++++++++++
> >  3 files changed, 37 insertions(+), 1 deletions(-)
> > 
> > diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
> > index 5b9ed0e..86d084e 100644
> > --- a/fs/nfsd/nfsctl.c
> > +++ b/fs/nfsd/nfsctl.c
> > @@ -503,7 +503,7 @@ static ssize_t write_ports(struct file *file, char *buf, size_t size)
> >  		int len = 0;
> >  		lock_kernel();
> >  		if (nfsd_serv)
> > -			len = svc_sock_names(buf, nfsd_serv, NULL);
> > +			len = svc_xprt_names(nfsd_serv, buf, 0);
> >  		unlock_kernel();
> >  		return len;
> >  	}
> > diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
> > index 840b5c4..ed9791a 100644
> > --- a/include/linux/sunrpc/svc_xprt.h
> > +++ b/include/linux/sunrpc/svc_xprt.h
> > @@ -81,6 +81,7 @@ void	svc_delete_xprt(struct svc_xprt *xprt);
> >  int	svc_port_is_privileged(struct sockaddr *sin);
> >  int	svc_print_xprts(char *buf, int maxlen);
> >  struct	svc_xprt *svc_find_xprt(struct svc_serv *, char *, int, int);
> > +int	svc_xprt_names(struct svc_serv *serv, char *buf, int buflen);
> >  static inline void svc_xprt_get(struct svc_xprt *xprt)
> >  {
> >  	kref_get(&xprt->xpt_ref);
> > diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
> > index 6708aa2..2e3a672 100644
> > --- a/net/sunrpc/svc_xprt.c
> > +++ b/net/sunrpc/svc_xprt.c
> > @@ -998,3 +998,38 @@ struct svc_xprt *svc_find_xprt(struct svc_serv *serv, char *xcl_name,
> >  	return found;
> >  }
> >  EXPORT_SYMBOL_GPL(svc_find_xprt);
> > +
> > +/*
> > + * Format a buffer with a list of the active transports. A zero for
> > + * the buflen parameter disables target buffer overflow checking.
> > + */
> > +int svc_xprt_names(struct svc_serv *serv, char *buf, int buflen)
> > +{
> > +	struct svc_xprt *xprt;
> > +	char xprt_str[64];
> > +	int totlen = 0;
> > +	int len;
> > +
> > +	/* Sanity check args */
> > +	if (!serv)
> > +		return 0;
> > +
> > +	spin_lock_bh(&serv->sv_lock);
> > +	list_for_each_entry(xprt, &serv->sv_permsocks, xpt_list) {
> > +		len = snprintf(xprt_str, sizeof(xprt_str),
> > +			       "%s %d\n", xprt->xpt_class->xcl_name,
> > +			       svc_xprt_local_port(xprt));
> > +		/* If the string was truncated, replace with error string */
> > +		if (len >= sizeof(xprt_str))
> > +			strcpy(xprt_str, "name-too-long\n");
> > +		/* Don't overflow buffer */
> > +		len = strlen(xprt_str);
> > +		if (buflen && (len + totlen >= buflen))
> > +			break;
> > +		strcpy(buf+totlen, xprt_str);
> > +		totlen += len;
> > +	}
> > +	spin_unlock_bh(&serv->sv_lock);
> > +	return totlen;
> > +}
> > +EXPORT_SYMBOL_GPL(svc_xprt_names);
> -
> 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:[~2007-12-21 17:46 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-11 23:31 [PATCH 00/38] svc: SVC Transport Switch Tom Tucker
     [not found] ` <20071211233150.15718.40579.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-11 23:31   ` [PATCH 01/38] svc: Add an svc transport class Tom Tucker
     [not found]     ` <20071211233152.15718.44241.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-13 18:45       ` J. Bruce Fields
2007-12-17  9:40         ` Tom Tucker
2007-12-17 17:45           ` J. Bruce Fields
2007-12-18  0:26             ` Tom Tucker
     [not found]               ` <1197937584.13463.44.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2007-12-18 14:54                 ` J. Bruce Fields
2007-12-18 15:00                   ` J. Bruce Fields
2007-12-18 15:04                   ` Tom Tucker
     [not found]                     ` <1197990256.13463.54.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2007-12-18 15:01                       ` J. Bruce Fields
2007-12-18 19:30                       ` Tom Tucker
     [not found]                         ` <1198006238.13463.79.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2007-12-18 19:28                           ` J. Bruce Fields
2007-12-11 23:31   ` [PATCH 02/38] svc: Make svc_sock the tcp/udp transport Tom Tucker
     [not found]     ` <20071211233156.15718.7813.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-13 19:01       ` J. Bruce Fields
2007-12-17  9:46         ` Tom Tucker
2007-12-11 23:31   ` [PATCH 03/38] svc: Change the svc_sock in the rqstp structure to a transport Tom Tucker
2007-12-11 23:32   ` [PATCH 04/38] svc: Add a max payload value to the transport Tom Tucker
2007-12-11 23:32   ` [PATCH 05/38] svc: Move sk_sendto and sk_recvfrom to svc_xprt_class Tom Tucker
2007-12-11 23:32   ` [PATCH 06/38] svc: Add transport specific xpo_release function Tom Tucker
     [not found]     ` <20071211233206.15718.73282.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-13 19:31       ` J. Bruce Fields
2007-12-17  9:53         ` Tom Tucker
2007-12-11 23:32   ` [PATCH 07/38] svc: Add per-transport delete functions Tom Tucker
2007-12-11 23:32   ` [PATCH 08/38] svc: Add xpo_prep_reply_hdr Tom Tucker
2007-12-11 23:32   ` [PATCH 09/38] svc: Add a transport function that checks for write space Tom Tucker
     [not found]     ` <20071211233212.15718.69282.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-12 18:10       ` Chuck Lever
2007-12-12 20:00         ` Tom Tucker
2007-12-13 21:33         ` J. Bruce Fields
2007-12-13 21:45           ` Chuck Lever
2007-12-13 22:20             ` Tom Tucker
     [not found]               ` <1197584427.6348.10.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2007-12-13 22:28                 ` J. Bruce Fields
2007-12-14 13:59                   ` Chuck Lever
2007-12-14 14:27                 ` Chuck Lever
2007-12-11 23:32   ` [PATCH 10/38] svc: Move close processing to a single place Tom Tucker
2007-12-11 23:32   ` [PATCH 11/38] svc: Add xpo_accept transport function Tom Tucker
     [not found]     ` <20071211233217.15718.14380.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-14 19:01       ` J. Bruce Fields
2007-12-14 19:14         ` Tom Tucker
2007-12-17 10:02         ` Tom Tucker
2007-12-14 19:55       ` J. Bruce Fields
2007-12-15  5:22         ` Tom Tucker
2007-12-17 10:49         ` Tom Tucker
2007-12-11 23:32   ` [PATCH 12/38] svc: Add a generic transport svc_create_xprt function Tom Tucker
2007-12-11 23:32   ` [PATCH 13/38] svc: Change services to use new svc_create_xprt service Tom Tucker
2007-12-11 23:32   ` [PATCH 14/38] svc: Change sk_inuse to a kref Tom Tucker
     [not found]     ` <20071211233224.15718.91339.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-14 20:52       ` J. Bruce Fields
2007-12-15 20:28         ` Tom Tucker
2007-12-11 23:32   ` [PATCH 15/38] svc: Move sk_flags to the svc_xprt structure Tom Tucker
2007-12-11 23:32   ` [PATCH 16/38] svc: Move sk_server and sk_pool to svc_xprt Tom Tucker
2007-12-11 23:32   ` [PATCH 17/38] svc: Make close transport independent Tom Tucker
2007-12-11 23:32   ` [PATCH 18/38] svc: Move sk_reserved to svc_xprt Tom Tucker
2007-12-11 23:32   ` [PATCH 19/38] svc: Make the enqueue service transport neutral and export it Tom Tucker
2007-12-11 23:32   ` [PATCH 20/38] svc: Make svc_send transport neutral Tom Tucker
2007-12-11 23:32   ` [PATCH 21/38] svc: Change svc_sock_received to svc_xprt_received and export it Tom Tucker
2007-12-11 23:32   ` [PATCH 22/38] svc: Move accept call to svc_xprt_received to common code Tom Tucker
2007-12-11 23:32   ` [PATCH 23/38] svc: Remove sk_lastrecv Tom Tucker
2007-12-11 23:32   ` [PATCH 24/38] svc: Move the authinfo cache to svc_xprt Tom Tucker
2007-12-11 23:32   ` [PATCH 25/38] svc: Make deferral processing xprt independent Tom Tucker
2007-12-11 23:32   ` [PATCH 26/38] svc: Move the sockaddr information to svc_xprt Tom Tucker
2007-12-11 23:32   ` [PATCH 27/38] svc: Make svc_sock_release svc_xprt_release Tom Tucker
2007-12-11 23:32   ` [PATCH 28/38] svc: Make svc_recv transport neutral Tom Tucker
2007-12-11 23:32   ` [PATCH 29/38] svc: Make svc_age_temp_sockets svc_age_temp_transports Tom Tucker
2007-12-11 23:33   ` [PATCH 30/38] svc: Move common create logic to common code Tom Tucker
     [not found]     ` <20071211233300.15718.30136.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-14 23:19       ` J. Bruce Fields
2007-12-15 22:14         ` Tom Tucker
2007-12-17 15:27         ` Tom Tucker
2007-12-11 23:33   ` [PATCH 31/38] svc: Removing remaining references to rq_sock in rqstp Tom Tucker
2007-12-11 23:33   ` [PATCH 32/38] svc: Make svc_check_conn_limits xprt independent Tom Tucker
2007-12-11 23:33   ` [PATCH 33/38] svc: Move the xprt independent code to the svc_xprt.c file Tom Tucker
2007-12-11 23:33   ` [PATCH 34/38] svc: Add transport hdr size for defer/revisit Tom Tucker
     [not found]     ` <20071211233309.15718.84852.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-14 23:37       ` J. Bruce Fields
2007-12-15 18:16         ` Tom Tucker
2007-12-11 23:33   ` [PATCH 35/38] svc: Add /proc/sys/sunrpc/transport files Tom Tucker
2007-12-11 23:33   ` [PATCH 36/38] svc: Add svc API that queries for a transport instance Tom Tucker
2007-12-11 23:33   ` [PATCH 37/38] knfsd: Support adding transports by writing portlist file Tom Tucker
     [not found]     ` <20071211233316.15718.85089.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-14 23:51       ` J. Bruce Fields
2007-12-21 17:52         ` Tom Tucker
     [not found]           ` <1198259550.14237.33.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2008-01-03 21:13             ` J. Bruce Fields
2008-01-08 17:45               ` Tom Tucker
2007-12-11 23:33   ` [PATCH 38/38] svc: Add svc_xprt_names service to replace svc_sock_names Tom Tucker
     [not found]     ` <20071211233318.15718.11614.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-15  0:03       ` J. Bruce Fields
2007-12-21 17:51         ` Tom Tucker [this message]
     [not found]           ` <1198259507.14237.31.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2008-01-03 21:14             ` J. Bruce Fields
2008-01-04  0:47               ` Neil Brown
     [not found]                 ` <18301.33306.486417.193770-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-01-14 13:27                   ` Tom Tucker

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=1198259507.14237.31.camel@trinity.ogc.int \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /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