Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1362700ybp; Thu, 17 Oct 2019 11:38:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCJEgNPQUuXsNzwVjNbiluhPftmyJQt6pQotlZTB4sKKfFMv60tIT+lzWgj9opt5heriAT X-Received: by 2002:a50:bac2:: with SMTP id x60mr5347335ede.96.1571337515390; Thu, 17 Oct 2019 11:38:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571337515; cv=none; d=google.com; s=arc-20160816; b=dZIZHiGSudE0O3w9lhVpbDTMzR7Vo3WAlB9PmL0947AUeOaaUe1JSLOpt2B3mrsx4v Evjyf/UhOPl+329vB6MmeSzXHI62+9hNEqM+ZauPDKYZvx12naXk7T7veJtwlXn2fe0A g0evuMmbzkjp06gQgUZk845TrDIQHwZNPdC9rmGKdFAD9gyd5DF5z3DphGYXXCRE8i3R xf03f3XpR4Z2yDCmh1+9Q8bUGHRxEwX9hc/1/uX0+31DACjvhQB91KC5Z3bUMu2zok0r MfGDVnxjZ+PGcPyzoI7w1vEmfpRMhlGLUvqRtEOeOUL0/DJRzU9CiNUcbv4wIlOjFDXr ZbcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from; bh=wgcmbrDf7jEfBuz5wHZqIrLtUWRuGqB7oA0xULqqxZg=; b=AaSq2WUNmUBLtsdO7MW1J51R51TRJWUWQLhJ0Ldk5WHjQsCTPfHmN1uen5EncGth+U Cz5ti1Xn7jF1JnpTXYLgeeOL9+6SVxz2L3cnQSMVITACeFichJ+dqhG4un+2s5xzpswl gWGKzKaD5GgrcMTaQ3HOfFQZwlzrOrr6CI6XLd6OMrvyMRr8vdEvnlH1bHtII8KT3OxP gIg5+KRGUpGU85RBEh88giqQ6f5D/I5QxQWkHtr4TD8e85Ha1WORNp/6Qm4XiEef1ycb zJI5/zvY8HQjgzQBjDEP29TvKXzOTq9ynoFCdvyz/ef3DkncfU/Vcr4SRVTZucWdFH7m J9xg== 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 y9si2039275edv.405.2019.10.17.11.37.58; Thu, 17 Oct 2019 11:38: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 S2392600AbfJPWIc (ORCPT + 99 others); Wed, 16 Oct 2019 18:08:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:59808 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2439085AbfJPWIb (ORCPT ); Wed, 16 Oct 2019 18:08:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 92831AF6A; Wed, 16 Oct 2019 22:08:29 +0000 (UTC) From: NeilBrown To: Trond Myklebust , linux-nfs@vger.kernel.org Date: Thu, 17 Oct 2019 09:08:22 +1100 Cc: Chuck Lever , Anna Schumaker , "J. Bruce Fields" Subject: Re: [PATCH 3/3] SUNRPC: Destroy the back channel when we destroy the host transport In-Reply-To: <20191016141546.32277-3-trond.myklebust@hammerspace.com> References: <20191016141546.32277-1-trond.myklebust@hammerspace.com> <20191016141546.32277-2-trond.myklebust@hammerspace.com> <20191016141546.32277-3-trond.myklebust@hammerspace.com> Message-ID: <87sgnspcmh.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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 > Signed-off-by: Trond Myklebust > --- > 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 *wo= rk) > 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. 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. Thanks, NeilBrown > /* > * Tear down transport state and free the rpc_xprt > */ > --=20 > 2.21.0 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAl2nlNcACgkQOeye3VZi gbk+Eg//ZQqXhWg0FBjoaDCiNvatLbCmR8H3rATecZU1mjJl3qxbf6kAyIPAwTnT UnC7ExvaiNFFpYj5nS3OBaLOQQLtt558C4V+KXYDTddemZ5IbRSCYje3fh1ASq+V LPzNxxcEfnbIOGHnhEpDccr8oua6V0drN10N6sYw/Zc+CeX7GQ9Xc0QanVuWMCbs z3spFOvYqIN+hQIPI1yDpBvqM/bd3yuus55qAp/Loti1+5iY7hRGXixfw/59dWwx IbOi+CWUzQ5gh0sMUM3GPZJg391l5zUXQP+TxPaVr6WRHykrvDKv00N2CJm0VIGW PXgzCcCXLizGnj+0DDDhL6ahqH186Sy0IU5VFAgtFxf2xQmsBM8f4MRqdjn1so/7 XwP7VUzkPL32gW3zwGWF8+iQ3uZUNE0/PB5zsZcok5pEwE+O4SJzb+SFPtyMO8jI 3mUtZFKHmrvUuiAURR4SS2SR+dWljDF8wG9jJvu35gAecJHSptVQK7NUNxbSuJMS c8opfZ2Gp+lFzWDCk9qRcO13eXLo4WpBxZdd0nVd0CnKSzYrptJH2mVtesPmS8fz XZuoADRGEWqURG/Nxq/wsm5LuTHXnDzlnsFvNuIszc3haZJJpU4VddMmQdJTb0pN KkTplKte2ytJZTAjxYwfLYtERuwudgV4PmLjVLNZuD2khyAj95Q= =ovy/ -----END PGP SIGNATURE----- --=-=-=--