Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3309139rwd; Sat, 3 Jun 2023 02:52:51 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ63JyvvIYXgLrv7ZOtEgBwRzZcOok+SnxMQsulnim9XCvxUsW/ax9EQm+Jz8+KQqVfEyAFB X-Received: by 2002:a05:6a20:5495:b0:111:4a86:f70 with SMTP id i21-20020a056a20549500b001114a860f70mr1642511pzk.6.1685785970795; Sat, 03 Jun 2023 02:52:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685785970; cv=none; d=google.com; s=arc-20160816; b=otwJ8Z8oesmPEQMw+wxWzALBfrXkxD8Vn1QtWqIXWaiDIaZHrZjKhxieAHmHH3inf2 Dji246H1JVEiP9y8f/dW4s93N4hVX0Kqoa48TJaYLhZGVTjUAT1iEfCgGEUIkNFsIwJS nL1bLKMhBrBCR/RC7lsMBmSwVIHgyKF3TjaxvnBg+3F3v1xBoEuywZRv3IWd5aPRZ9OW JmceUzycHNnwwPGkOpCJX8hhxN6saWcvbKaxtxs8qbyNMKBRYBcZVCUzDEvPwkMev+dr clxadjgdEuTTrb8IbdcNhLlLDlnMHjv4UlZmUKxhr6D2LRSgZPPqmwOb30hHo5f2Bpik cw1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=G+26Y7LTbSx5pPxMyCY0C/ca8ZBZskQsUKX1JfLcFD0=; b=JCjrfykGPdG2SvGd/MxmHJ9w+6vdeVaC+Xhbb66WyArV2C+gbqxRMAO6O2MLjOt3Sj 90yeouvD5prgPTXbzVDZ6i8HoCq5ZTQBonwwhwWMEbrMkczZOqMNp+d3cPEwsY0+QOHH kMkmg19YbmkZq4odpqwPwC+hUhEEMElVaQuPAbxhboHBL+COntHp+j0Gi2F1PihOE3gU 0NofLP6t9yoMKaB3VWUHfvJojBsS1QGsQ7rGshS1zgjYT+WCHzK3GdKmy3Wlgy/SBD5m kehd7KiTyQGJYkEUBx1Qdu3CYBmQlasipdTNb0nKWvV+KjaUBRX8zt8/kpAJWZNrzk4P NZtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=R6CJCLKP; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c21-20020a637255000000b0053fb85dd81asi2436316pgn.325.2023.06.03.02.52.16; Sat, 03 Jun 2023 02:52:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=R6CJCLKP; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbjFCJd5 (ORCPT + 99 others); Sat, 3 Jun 2023 05:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229673AbjFCJd4 (ORCPT ); Sat, 3 Jun 2023 05:33:56 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 951A6E49 for ; Sat, 3 Jun 2023 02:33:55 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 496845C0140; Sat, 3 Jun 2023 05:33:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Sat, 03 Jun 2023 05:33:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1685784833; x=1685871233; bh=G+26Y7LTbSx5p PxMyCY0C/ca8ZBZskQsUKX1JfLcFD0=; b=R6CJCLKPbjiydOk7GOke4wlcYj65p FPRc0/TFalRaTHHlC4sB1PFpA3zUn7uBT12vO8zVF00mtZ07rtinNxKwl3zqWUA0 zoDMmKZ93J6zRr8FZMtrNd2BGKNuWDNYnJrGCw1wW012/f+f7dRvTKgO6PfoFB2x 7RMLv+nMeG06e19xPUgp6jWunZQX/wlXCt2UbIrSDdRFyAvBEZJHtRZvM5cElQi/ O5lvtoZruUlgZrIwdbDYDMMkWnrnQcMsC1QT/CT4SrKfYXeJvKfRNYmRA5dDgHu3 8uQ5Z1nvfsSredOPMjBhZzAU1O1Vkr9vWkIp0+f0XZskzvdUMTK45qDBA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeelhedgudekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepkfguohcu ufgthhhimhhmvghluceoihguohhstghhsehiughoshgthhdrohhrgheqnecuggftrfgrth htvghrnhepvddufeevkeehueegfedtvdevfefgudeifeduieefgfelkeehgeelgeejjeeg gefhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepih guohhstghhsehiughoshgthhdrohhrgh X-ME-Proxy: Feedback-ID: i494840e7:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 3 Jun 2023 05:33:52 -0400 (EDT) Date: Sat, 3 Jun 2023 12:33:48 +0300 From: Ido Schimmel To: NeilBrown Cc: "J. Bruce Fields" , Chuck Lever , linux-nfs@vger.kernel.org Subject: Re: [PATCH 13/20] lockd: move lockd_start_svc() call into lockd_create_svc() Message-ID: References: <163816133466.32298.13831616524908720974.stgit@noble.brown> <163816148560.32298.15560175172815507979.stgit@noble.brown> <168574130862.10905.10707785007987424080@noble.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <168574130862.10905.10707785007987424080@noble.neil.brown.name> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Sat, Jun 03, 2023 at 07:28:28AM +1000, NeilBrown wrote: > From: NeilBrown > Date: Sat, 3 Jun 2023 07:14:14 +1000 > Subject: [PATCH] lockd: drop inappropriate svc_get() from locked_get() > > The below-mentioned patch was intended to simplify refcounting on the > svc_serv used by locked. The goal was to only ever have a single > reference from the single thread. To that end we dropped a call to > lockd_start_svc() (except when creating thread) which would take a > reference, and dropped the svc_put(serv) that would drop that reference. > > Unfortunately we didn't also remove the svc_get() from > lockd_create_svc() in the case where the svc_serv already existed. > So after the patch: > - on the first call the svc_serv was allocated and the one reference > was given to the thread, so there are no extra references > - on subsequent calls svc_get() was called so there is now an extra > reference. > This is clearly not consistent. > > The inconsistency is also clear in the current code in lockd_get() > takes *two* references, one on nlmsvc_serv and one by incrementing > nlmsvc_users. This clearly does not match lockd_put(). > > So: drop that svc_get() from lockd_get() (which used to be in > lockd_create_svc(). > > Reported-by: Ido Schimmel > Fixes: b73a2972041b ("lockd: move lockd_start_svc() call into lockd_create_svc()") > Signed-off-by: NeilBrown Thanks for the quick fix. I no longer see the memory leak with this patch. Tested-by: Ido Schimmel