public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@hammerspace.com>
To: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"neilb@suse.de" <neilb@suse.de>
Cc: "Anna.Schumaker@netapp.com" <Anna.Schumaker@netapp.com>,
	"bfields@redhat.com" <bfields@redhat.com>,
	"chuck.lever@oracle.com" <chuck.lever@oracle.com>
Subject: Re: [PATCH 3/3] SUNRPC: Destroy the back channel when we destroy the host transport
Date: Thu, 17 Oct 2019 13:06:12 +0000	[thread overview]
Message-ID: <f6d731533113a09e8ee4a2894f4ad0432e9fb66e.camel@hammerspace.com> (raw)
In-Reply-To: <87sgnspcmh.fsf@notabene.neil.brown.name>

On Thu, 2019-10-17 at 09:08 +1100, NeilBrown wrote:
> On Wed, Oct 16 2019, Trond Myklebust wrote:
> 
> > When we're destroying the host transport mechanism, we should
> > ensure
> > that we do not leak memory by failing to release any back channel
> > slots that might still exist.
> > 
> > Reported-by: Neil Brown <neilb@suse.de>
> > Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> > ---
> >  net/sunrpc/xprt.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/net/sunrpc/xprt.c b/net/sunrpc/xprt.c
> > index 8a45b3ccc313..41df4c507193 100644
> > --- a/net/sunrpc/xprt.c
> > +++ b/net/sunrpc/xprt.c
> > @@ -1942,6 +1942,11 @@ static void xprt_destroy_cb(struct
> > work_struct *work)
> >  	rpc_destroy_wait_queue(&xprt->sending);
> >  	rpc_destroy_wait_queue(&xprt->backlog);
> >  	kfree(xprt->servername);
> > +	/*
> > +	 * Destroy any existing back channel
> > +	 */
> > +	xprt_destroy_backchannel(xprt, UINT_MAX);
> > +
> 
> This will cause xprt->bc_alloc_max to become meaningless.

Fixed in v2.

> That isn't really a problem as the xprt is about to be freed, but it
> still seems a little untidy - fragile maybe.
> How about another line in the comment:
> 
>    * Note: this corrupts ->bc_alloc_max, but it is too late for that
> to
>    * matter.
> ??
> 
> Also, possibly add
>  WARN_ON(atomic_read(&xprt->bc_slot_count);
> either before or after the xprt_destroy_backchannel - because there
> really shouldn't be any requests by this stage.

I considered it, but since RDMA doesn't use those variable, it wouldn't
really be a sufficient check.

Thanks
  Trond

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



  reply	other threads:[~2019-10-17 13:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-16 14:15 [PATCH 1/3] SUNRPC: The TCP back channel mustn't disappear while requests are outstanding Trond Myklebust
2019-10-16 14:15 ` [PATCH 2/3] SUNRPC: The RDMA " Trond Myklebust
2019-10-16 14:15   ` [PATCH 3/3] SUNRPC: Destroy the back channel when we destroy the host transport Trond Myklebust
2019-10-16 22:08     ` NeilBrown
2019-10-17 13:06       ` Trond Myklebust [this message]
2019-10-16 21:38 ` [PATCH 1/3] SUNRPC: The TCP back channel mustn't disappear while requests are outstanding J. Bruce Fields
2019-10-16 22:24 ` NeilBrown
2019-10-17 12:43   ` Trond Myklebust

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=f6d731533113a09e8ee4a2894f4ad0432e9fb66e.camel@hammerspace.com \
    --to=trondmy@hammerspace.com \
    --cc=Anna.Schumaker@netapp.com \
    --cc=bfields@redhat.com \
    --cc=chuck.lever@oracle.com \
    --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