Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Tom Tucker <tom@opengridcomputing.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [RFC,PATCH 12/38] svc: Add a generic transport svc_create_xprt function
Date: Thu, 3 Jan 2008 14:00:32 -0500	[thread overview]
Message-ID: <20080103190032.GD15354@fieldses.org> (raw)
In-Reply-To: <1198261117.14237.47.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>

On Fri, Dec 21, 2007 at 12:18:37PM -0600, Tom Tucker wrote:
> 
> On Fri, 2007-12-14 at 18:05 -0500, J. Bruce Fields wrote:
> > On Thu, Nov 29, 2007 at 04:56:03PM -0600, Tom Tucker wrote:
> > > --- a/net/sunrpc/svc_xprt.c
> > > +++ b/net/sunrpc/svc_xprt.c
> > > @@ -93,3 +93,40 @@ void svc_xprt_init(struct svc_xprt_class *xcl, struct svc_xprt *xprt)
> > >  	xprt->xpt_ops = xcl->xcl_ops;
> > >  }
> > >  EXPORT_SYMBOL_GPL(svc_xprt_init);
> > > +
> > > +int svc_create_xprt(struct svc_serv *serv, char *xprt_name, unsigned short port,
> > > +		    int flags)
> > > +{
> > > +	struct svc_xprt_class *xcl;
> > > +	int ret = -ENOENT;
> > > +	struct sockaddr_in sin = {
> > > +		.sin_family		= AF_INET,
> > > +		.sin_addr.s_addr	= INADDR_ANY,
> > > +		.sin_port		= htons(port),
> > > +	};
> > > +	dprintk("svc: creating transport %s[%d]\n", xprt_name, port);
> > > +	spin_lock(&svc_xprt_class_lock);
> > > +	list_for_each_entry(xcl, &svc_xprt_class_list, xcl_list) {
> > > +		if (strcmp(xprt_name, xcl->xcl_name) == 0) {
> > > +			spin_unlock(&svc_xprt_class_lock);
> > > +			if (try_module_get(xcl->xcl_owner)) {
> > 
> > 
> > Hm.  I wonder if this is right.  Don't you need to do the try_module_get
> > while still under the svc_xprt_class_lock?
> > 
> 
> Hmm. This is an interesting question. I'm was assuming that the
> unregister call from the transport provider comes from the module_exit
> function.

Oh.  Are all module init/exit functions serialized?

The case I was wondering about was something like:

	task 1				task 2
	registering xcl named "foo"	unregistering different xcl also
					named "foo".

	Gets pointer to xcl which
	task 2 is unregistering,
	drops svc_xprt_class_lock.

					acquires svc_xprt_class_lock,
					frees the xcl.

	try_module_get(xcl->cl_owner)

But I don't understand the module code well enough to understand whether
that's possible.

> If it doesn't then you are correct you could have an active
> reference to a module that is not present in the transport class list. 

I think it's fine to assume that register will always be called from
init code and unregister from the module code, so if that solves the
problem, great.

--b.

  parent reply	other threads:[~2008-01-03 19:00 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 22:55 [RFC,PATCH 00/38] RPC Transport Switch Tom Tucker
     [not found] ` <20071129225510.15275.82660.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-29 22:55   ` [RFC,PATCH 01/38] svc: Add an svc transport class Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 02/38] svc: Make svc_sock the tcp/udp transport Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 03/38] svc: Change the svc_sock in the rqstp structure to a transport Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 04/38] svc: Add a max payload value to the transport Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 05/38] svc: Move sk_sendto and sk_recvfrom to svc_xprt_class Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 06/38] svc: Add transport specific xpo_release function Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 07/38] svc: Add per-transport delete functions Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 08/38] svc: Add xpo_prep_reply_hdr Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 09/38] svc: Add a transport function that checks for write space Tom Tucker
2007-11-29 22:55   ` [RFC,PATCH 10/38] svc: Move close processing to a single place Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 11/38] svc: Add xpo_accept transport function Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 12/38] svc: Add a generic transport svc_create_xprt function Tom Tucker
     [not found]     ` <20071129225603.15275.54556.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-12-14 23:05       ` J. Bruce Fields
2007-12-21 18:18         ` Tom Tucker
     [not found]           ` <1198261117.14237.47.camel-SMNkleLxa3ZimH42XvhXlA@public.gmane.org>
2008-01-03 19:00             ` J. Bruce Fields [this message]
2007-11-29 22:56   ` [RFC,PATCH 13/38] svc: Change services to use new svc_create_xprt service Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 14/38] svc: Change sk_inuse to a kref Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 15/38] svc: Move sk_flags to the svc_xprt structure Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 16/38] svc: Move sk_server and sk_pool to svc_xprt Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 17/38] svc: Make close transport independent Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 18/38] svc: Move sk_reserved to svc_xprt Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 19/38] svc: Make the enqueue service transport neutral and export it Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 20/38] svc: Make svc_send transport neutral Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 21/38] svc: Change svc_sock_received to svc_xprt_received and export it Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 22/38] svc: Remove sk_lastrecv Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 24/38] svc: Make deferral processing xprt independent Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 25/38] svc: Move the sockaddr information to svc_xprt Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 26/38] svc: Make svc_sock_release svc_xprt_release Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 27/38] svc: Make svc_recv transport neutral Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 28/38] svc: Make svc_age_temp_sockets svc_age_temp_transports Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 29/38] svc: Move common create logic to common code Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 30/38] svc: Removing remaining references to rq_sock in rqstp Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 31/38] svc: Make svc_check_conn_limits xprt independent Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 32/38] svc: Move the xprt independent code to the svc_xprt.c file Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 33/38] svc: Add transport hdr size for defer/revisit Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 34/38] svc: Add /proc/sys/sunrpc/transport files Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 35/38] knfsd: Support adding transports by writing portlist file Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 36/38] svc: Add svc API that queries for a transport instance Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 37/38] knfsd: Modify write_ports to use svc_find_xprt service Tom Tucker
2007-11-29 22:56   ` [RFC,PATCH 38/38] svc: Add svc_xprt_names service to replace svc_sock_names Tom Tucker
2007-11-30  0:27   ` [RFC,PATCH 00/38] RPC Transport Switch J. Bruce Fields
2007-11-30  2:01     ` Tom Tucker
  -- strict thread matches above, loose matches on Subject: below --
2007-11-29 22:51 [RFC,PATCH 00/38] SVC " Tom Tucker
     [not found] ` <20071129225142.15107.46200.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-29 22:53   ` [RFC,PATCH 12/38] svc: Add a generic transport svc_create_xprt function Tom Tucker
2007-11-29 22:39 [RFC,PATCH 00/38] SVC Transport Switch Tom Tucker
     [not found] ` <20071129223917.14563.77633.stgit-gUwIgmpLGaKNDNWfRnPdfg@public.gmane.org>
2007-11-29 22:40   ` [RFC,PATCH 12/38] svc: Add a generic transport svc_create_xprt function 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=20080103190032.GD15354@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=tom@opengridcomputing.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