Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1167029ybp; Fri, 11 Oct 2019 09:56:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwI3O0N9BLj3ZIW8596bRMj9JEcbecp/B9bLvBqCANcKLalsN/7aUkg8tFfIBTTIHM5oDjX X-Received: by 2002:a50:f198:: with SMTP id x24mr15345662edl.238.1570812995127; Fri, 11 Oct 2019 09:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570812995; cv=none; d=google.com; s=arc-20160816; b=qk7TY11/k0ydNNIaWSSi41mjsDZt1OLpTFPaqMC7wSkUZ1L+2Wd4JDP6y9rzMdz871 ScpXER+dt9uihRSF5PkD1+/wfILhde+f09rifod9G17zrMfRgAd3Sm4pk4mgyOpnkD2T EJbNLhE/H2I7wlTtNM4txs/kkhigVE64TnqO1sbre0rH21jfVALDk92NfJCyAn0MO/qj mQXRCT6D6T1aKMWZLgG11HwV9LEplaAXZ8O0802UgGg3rMor01SNEw4BwfpkOCXgzp8K o5nGz4qLdWPHnJKrFrzFS32gME7fYU0rDdyNyCJkzOwJkFO0zYaL9mDaMHHnwCioNQgk kQlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:from:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:date; bh=A0MU/GPHqY01s8Swc98sPU4Id45UYrSRj9WtH3Gmo3w=; b=sQj6Z24TfbRNh0P78Uk676w8IyKm8l3ohthW4CRY0uc9AH6bSm66bH9wDQTAGtNk4R wQGkHOtg58WYHGVSrSzk0Pvnx9Ffn6KfXXFddKRYthvMJzBVW9RGmDc/UcVh9j4y5WY2 sAim44raQ81pEDKRq8FoPrjItvbOaevBMAQMWnUIIvEjr+gKX7L5cltz/zVBTyPj/xJL BHf3tHcQPs3XFpQdIzNSe/DDtdwc/YJOXyF9D5y2UPNWD9kOfNiN4vDb4Ysq7Q2Qc96z P9PNnHRBnqD9PMy4ZMfKsVICzguFNQ9SrAkGYOEvOre4JW+VhhnkwxcCSYui4ydwkGF7 Cynw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29si6001778eje.235.2019.10.11.09.56.09; Fri, 11 Oct 2019 09:56:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728374AbfJKQ4E (ORCPT + 99 others); Fri, 11 Oct 2019 12:56:04 -0400 Received: from fieldses.org ([173.255.197.46]:59056 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728106AbfJKQ4E (ORCPT ); Fri, 11 Oct 2019 12:56:04 -0400 Received: by fieldses.org (Postfix, from userid 2815) id A543D1C97; Fri, 11 Oct 2019 12:56:03 -0400 (EDT) Date: Fri, 11 Oct 2019 12:56:03 -0400 To: NeilBrown Cc: Linux NFS Mailing List Subject: Re: NFSv4.1 backchannel xprt problems. Message-ID: <20191011165603.GD19318@fieldses.org> References: <87tv8iqz3b.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87tv8iqz3b.fsf@notabene.neil.brown.name> User-Agent: Mutt/1.5.21 (2010-09-15) From: bfields@fieldses.org (J. Bruce Fields) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 */