Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1098917rwi; Wed, 19 Oct 2022 06:45:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7oz2p3nXqbwFkDOn3mF9kiwIG5VfXnTonW/MKEn9sWAO4+mzy7W+NrMF5FVJunJuIhcQHE X-Received: by 2002:a17:902:c952:b0:183:6e51:4fa with SMTP id i18-20020a170902c95200b001836e5104famr8858888pla.42.1666187120812; Wed, 19 Oct 2022 06:45:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666187120; cv=none; d=google.com; s=arc-20160816; b=UNLyuMVCt4o13268aWdxLAnvGtZz1SWopbpSrvMiuypObcRVVBTBg2/Z5wqLqtwv7w xAvtpxKfSLbjAm1TjV2yAA46RKCJ6uN9RQkostSJlzkA0nKvQ5/2ygDMMV3izAODagyX 9qE1+d8N12weZQRxmdKDwzHnmsqteyp+Cyhd8Eq6nuX9CwVDy0hiLbXNfWVyVImd42Zu GIEYUcssZA9Mka/nBlhTLhuTwrVC0mzx/WXzP2A4OXmE5A2f+5ILKAOd6I57MaGILAyI EKGl0+O1zZ8h7Hofnn1rWS7kMq3ztvxbvMKnDUueFvrzzX5L1ML7RWSQhTZIIyKdUSMA IfNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=xXHKnP4vmpLu3vaK+jyY4saVLlGyeJsbiOecoloY0MY=; b=qv7aTI9/u/AJHODqyj+AnnQi9UaL6OWWYRV+91BVWvsn5hu84Gey7T1u4FgpeD0L+5 uKp9csBSMwFmFWXOphndEiA6qDnbiLlQVi4uEMZyZqoHfkc20bI0p+YujtXu54oWHh2R TnhfLgWqXH7+cwxyxn0L0N3IIBPpsrxEt8D6r/Xg0H6nQnOLhnsT9afRTUkWUBpunyQk xj5ZfwnfEySw8gkfb156jgP3IqfQwdsLB3ejVRhk3Q+NCAHBZxE1zFJlSHQysKlccN5A M14GCgR1Ehruq0z3ESr2r61fTHK9Wv9ky/Y3V/oiuF+nkN25Ut8gsFqwH+IH0av4h4Tf nuDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZO8TofeR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u4-20020a17090341c400b0017f92d54633si21265962ple.243.2022.10.19.06.44.50; Wed, 19 Oct 2022 06:45:20 -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=@kernel.org header.s=k20201202 header.b=ZO8TofeR; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232693AbiJSNmQ (ORCPT + 99 others); Wed, 19 Oct 2022 09:42:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232754AbiJSNlk (ORCPT ); Wed, 19 Oct 2022 09:41:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60F1016C230 for ; Wed, 19 Oct 2022 06:29:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4B579B822E4 for ; Wed, 19 Oct 2022 10:48:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9A38C433C1; Wed, 19 Oct 2022 10:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666176521; bh=FsQtlUHeJQalKwHLzeQF0x+oKTVAlPfHDpCSe3ejaos=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=ZO8TofeRZPv80ZcL2eDv//A07vquKVoTwSyZV0yzGM5hkjMKIvwUyQovZycgHBaOp tIVXjIbWT6Ku8oFclT3ZoMGqGfrIkLMv5Bv9X32vkNDDwCDalG83OGu35AchGgU8la C7ePxskI4BlCrlt7CJnlhFsVvCpRkWTQPP1YwN9gMPjfd7vulg8qFsMG4MctYilL1L bf5vY43aXKTYOg2XHGKr+oVCGAKAA6x3dVKEOedGnMeTQTSjkV1inNh7yej5AFhy1b WsO3GESeGi4Y7sg2kdZbfYmuP+UnKVx8N4hGKkZn8nB+holwRmXN+qI8Pt05SSrhLV QsOxOm8YFICYQ== Message-ID: <25454461d696b25482a1b48aed10abda1d1c2060.camel@kernel.org> Subject: Re: [PATCH v4 2/7] NFSD: Revert "NFSD: NFSv4 CLOSE should release an nfsd_file immediately" From: Jeff Layton To: Chuck Lever , linux-nfs@vger.kernel.org Cc: neilb@suse.de Date: Wed, 19 Oct 2022 06:48:39 -0400 In-Reply-To: <166612311196.1291.3976661000746956975.stgit@manet.1015granger.net> References: <166612295223.1291.11761205673682408148.stgit@manet.1015granger.net> <166612311196.1291.3976661000746956975.stgit@manet.1015granger.net> Content-Type: text/plain; charset="ISO-8859-15" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Tue, 2022-10-18 at 15:58 -0400, Chuck Lever wrote: > This reverts commit 5e138c4a750dc140d881dab4a8804b094bbc08d2. >=20 > That commit attempted to make files available to other users as soon > as all NFSv4 clients were done with them, rather than waiting until > the filecache LRU had garbage collected them. >=20 > It gets the reference counting wrong, for one thing. >=20 > But it also misses that DELEGRETURN should release a file in the > same fashion. In fact, any nfsd_file_put() on an file held open > by an NFSv4 client needs potentially to release the file > immediately... >=20 > Clear the way for implementing that idea. >=20 > Signed-off-by: Chuck Lever > --- > fs/nfsd/filecache.c | 18 ------------------ > fs/nfsd/filecache.h | 1 - > fs/nfsd/nfs4state.c | 4 ++-- > 3 files changed, 2 insertions(+), 21 deletions(-) >=20 > diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c > index a2adfc247648..b7aa523c2010 100644 > --- a/fs/nfsd/filecache.c > +++ b/fs/nfsd/filecache.c > @@ -444,24 +444,6 @@ nfsd_file_put(struct nfsd_file *nf) > nfsd_file_put_noref(nf); > } > =20 > -/** > - * nfsd_file_close - Close an nfsd_file > - * @nf: nfsd_file to close > - * > - * If this is the final reference for @nf, free it immediately. > - * This reflects an on-the-wire CLOSE or DELEGRETURN into the > - * VFS and exported filesystem. > - */ > -void nfsd_file_close(struct nfsd_file *nf) > -{ > - nfsd_file_put(nf); > - if (refcount_dec_if_one(&nf->nf_ref)) { > - nfsd_file_unhash(nf); > - nfsd_file_lru_remove(nf); > - nfsd_file_free(nf); > - } > -} > - > struct nfsd_file * > nfsd_file_get(struct nfsd_file *nf) > { > diff --git a/fs/nfsd/filecache.h b/fs/nfsd/filecache.h > index 8e8c0c47d67d..f81c198f4ed6 100644 > --- a/fs/nfsd/filecache.h > +++ b/fs/nfsd/filecache.h > @@ -52,7 +52,6 @@ void nfsd_file_cache_shutdown(void); > int nfsd_file_cache_start_net(struct net *net); > void nfsd_file_cache_shutdown_net(struct net *net); > void nfsd_file_put(struct nfsd_file *nf); > -void nfsd_file_close(struct nfsd_file *nf); > struct nfsd_file *nfsd_file_get(struct nfsd_file *nf); > void nfsd_file_close_inode_sync(struct inode *inode); > bool nfsd_file_is_cached(struct inode *inode); > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c > index c5d199d7e6b4..2b850de288cf 100644 > --- a/fs/nfsd/nfs4state.c > +++ b/fs/nfsd/nfs4state.c > @@ -820,9 +820,9 @@ static void __nfs4_file_put_access(struct nfs4_file *= fp, int oflag) > swap(f2, fp->fi_fds[O_RDWR]); > spin_unlock(&fp->fi_lock); > if (f1) > - nfsd_file_close(f1); > + nfsd_file_put(f1); > if (f2) > - nfsd_file_close(f2); > + nfsd_file_put(f2); > } > } > =20 >=20 >=20 Reviewed-by: Jeff Layton