public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@citi.umich.edu>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 02/11] sunrpc: take reference to bc_xprt in sunrpc layer
Date: Wed, 10 Mar 2010 14:05:45 -0500	[thread overview]
Message-ID: <20100310190545.GC23974@fieldses.org> (raw)
In-Reply-To: <1268182980.9419.40.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

On Tue, Mar 09, 2010 at 08:03:00PM -0500, Trond Myklebust wrote:
> On Tue, 2010-03-09 at 19:28 -0500, J. Bruce Fields wrote: 
> > Currently we're requiring whoever holds the reference to a client set up
> > the on the backchannel to also hold a reference to the forechannel
> > transport; but this should be the responsibility of the lower level
> > code.
> > 
> > Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
> > Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
> > ---
> >  net/sunrpc/xprtsock.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
> > index a91f0a4..5adc000 100644
> > --- a/net/sunrpc/xprtsock.c
> > +++ b/net/sunrpc/xprtsock.c
> > @@ -792,6 +792,8 @@ static void xs_destroy(struct rpc_xprt *xprt)
> >  
> >  	xs_close(xprt);
> >  	xs_free_peer_addresses(xprt);
> > +	if (xprt->bc_xprt)
> > +		svc_xprt_put(xprt->bc_xprt);
> >  	kfree(xprt->slot);
> >  	kfree(xprt);
> >  	module_put(THIS_MODULE);
> > @@ -2510,6 +2512,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
> >  	 * forechannel
> >  	 */
> >  	xprt->bc_xprt = args->bc_xprt;
> > +	svc_xprt_get(xprt->bc_xprt);
> >  	bc_sock = container_of(args->bc_xprt, struct svc_sock, sk_xprt);
> >  	bc_sock->sk_bc_xprt = xprt;
> >  	transport->sock = bc_sock->sk_sock;
> > @@ -2552,6 +2555,7 @@ static struct rpc_xprt *xs_setup_bc_tcp(struct xprt_create *args)
> >  		return xprt;
> >  	ret = ERR_PTR(-EINVAL);
> >  out_err:
> > +	svc_xprt_put(xprt->bc_xprt);
> >  	kfree(xprt->slot);
> >  	kfree(xprt);
> >  	return ret;
> 
> OK... This makes my head spin.
> 
> Why should the back channel socket hold a reference to the svc_sock? The
> process that owns both of these things is an RPC server process. It
> already holds a reference to the svc_sock and presumably also to the
> back channel socket.

Only while it's actually processing an rpc, I assume.  

I'll take a harder look at what should be the lifetime of the server
socket that the backchannel requests use.

By the way, we also need to make sure the nfs server code gets some kind
of call when the client closes the connection, so we can set
callback-down session flags appropriately.

--b.

  parent reply	other threads:[~2010-03-10 19:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10  0:28 allowing client to change callback path J. Bruce Fields
2010-03-10  0:28 ` [PATCH 01/11] sunrpc: fix leak on error on socket xprt setup J. Bruce Fields
2010-03-10  0:28   ` [PATCH 02/11] sunrpc: take reference to bc_xprt in sunrpc layer J. Bruce Fields
2010-03-10  0:28     ` [PATCH 03/11] nfsd4: don't store cb_xprt in client J. Bruce Fields
2010-03-10  0:28       ` [PATCH 04/11] nfsd4: preallocate nfs4_rpc_args J. Bruce Fields
2010-03-10  0:28         ` [PATCH 05/11] nfsd4: shutdown callbacks on expiry J. Bruce Fields
2010-03-10  0:28           ` [PATCH 06/11] nfsd4: remove dprintk J. Bruce Fields
2010-03-10  0:28             ` [PATCH 07/11] nfsd4: remove probe task's reference on client J. Bruce Fields
2010-03-10  0:28               ` [PATCH 08/11] nfsd4: don't sleep in lease-break callback J. Bruce Fields
2010-03-10  0:28                 ` [PATCH 09/11] nfsd: cl_count is unused J. Bruce Fields
2010-03-10  0:28                   ` [PATCH 10/11] nfsd4: rearrange cb data structures J. Bruce Fields
2010-03-10  0:28                     ` [PATCH 11/11] nfsd4: allow 4.0 clients to change callback path J. Bruce Fields
2010-03-10  1:03     ` [PATCH 02/11] sunrpc: take reference to bc_xprt in sunrpc layer Trond Myklebust
     [not found]       ` <1268182980.9419.40.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-10 19:05         ` J. Bruce Fields [this message]
2010-03-18 15:08           ` J. Bruce Fields
2010-04-08 16:08             ` 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=20100310190545.GC23974@fieldses.org \
    --to=bfields@citi.umich.edu \
    --cc=Trond.Myklebust@netapp.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