From: bfields@fieldses.org (J. Bruce Fields)
To: NeilBrown <neilb@suse.de>
Cc: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: NFSv4.1 backchannel xprt problems.
Date: Fri, 11 Oct 2019 12:56:03 -0400 [thread overview]
Message-ID: <20191011165603.GD19318@fieldses.org> (raw)
In-Reply-To: <87tv8iqz3b.fsf@notabene.neil.brown.name>
On Wed, Oct 09, 2019 at 04:15:04PM +1100, NeilBrown wrote:
> I have a customer with a 4.12-based kernel who is experiencing memory
> exhaustion.
>
> There are over 100,000 rpc_rqst structures queue on sv_cb_list for
> handing by the NFSv4 callback, which is idle.
>
> The rpc_rqst.rq_xprt pointer points to freed memory.
>
> I notice that that server code calls svc_xprt_get() on the xprt
> before storing it in rq_xprt, but the client/backchannel code doesn't.
>
> I'm wondering if the following might be useful.
>
> I plan to explore the code a bit more tomorrow and if this still seems
> likely I get the customer to test this change, but I thought I would
> ask here as well incase someone more knowledgeable can give me any
> pointers.
Looks sensible. But if I ever understood how this works, I've got no
memory of it now.... Good luck.
>
> Thanks,
> NeilBrown
>
> diff --git a/net/sunrpc/backchannel_rqst.c b/net/sunrpc/backchannel_rqst.c
> index 339e8c077c2d..c95ca39688b6 100644
> --- a/net/sunrpc/backchannel_rqst.c
> +++ b/net/sunrpc/backchannel_rqst.c
> @@ -61,6 +61,7 @@ static void xprt_free_allocation(struct rpc_rqst *req)
> free_page((unsigned long)xbufp->head[0].iov_base);
> xbufp = &req->rq_snd_buf;
> free_page((unsigned long)xbufp->head[0].iov_base);
> + xprt_put(req->rq_xprt);
> kfree(req);
> }
>
> @@ -85,7 +86,7 @@ struct rpc_rqst *xprt_alloc_bc_req(struct rpc_xprt *xprt, gfp_t gfp_flags)
> if (req == NULL)
> return NULL;
>
> - req->rq_xprt = xprt;
> + req->rq_xprt = xprt_get(xprt);
> INIT_LIST_HEAD(&req->rq_bc_list);
>
> /* Preallocate one XDR receive buffer */
next prev parent reply other threads:[~2019-10-11 16:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 5:15 NFSv4.1 backchannel xprt problems NeilBrown
2019-10-11 16:56 ` J. Bruce Fields [this message]
2019-10-14 23:36 ` [PATCH] SUNRPC: backchannel RPC request must reference XPRT NeilBrown
2019-10-15 21:16 ` Trond Myklebust
2019-10-15 21:47 ` Chuck Lever
2019-10-15 23:23 ` NeilBrown
2019-10-16 3:04 ` Trond Myklebust
2019-10-16 4:38 ` NeilBrown
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=20191011165603.GD19318@fieldses.org \
--to=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;
as well as URLs for NNTP newsgroup(s).