Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1180520rwb; Thu, 6 Oct 2022 09:24:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6vQs1rW16nbfZevAycZinkBAG+BgZe54n34igP+XR6GDaDnxDqkPvWr6hM+XazXKlfMxX1 X-Received: by 2002:a63:211a:0:b0:451:f444:3b55 with SMTP id h26-20020a63211a000000b00451f4443b55mr563701pgh.60.1665073474407; Thu, 06 Oct 2022 09:24:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665073474; cv=none; d=google.com; s=arc-20160816; b=TYei0yxPM2AcN1mvSqf/PfY6tdr/TAV+UnnzFX7tOKh4FIUFU26Si1Rcq+Bi2NImvt phCq0nPh/IQ+aj541xzKYkRWiR5uliXsw+XdtbImufdC75u5fMIq3BAg75OT+d09yHoz RmODIgTEiakZ70Sdbdiaj2Pa6sFlKR7Ge85ndymrLcyaWYzwpMlxSybCTbuKNbvjtIIo kRO5FPpOrUq6pJSjqbf/sHVsLfDvaVsQ4xc0eJ4dVK91ytj9eWrL0QTPadZ/Vfm7eBr3 3vIbuip7PnMnmpa5DVaFVHYMOTmC7zEiJ7UGBQGbXAo+7Lo7zaYLexYZ6uO2csPIFLnb tANA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject; bh=fhBg9Qg5jr7JTcDhMEndWRmeshh8mBa14i4EAjDz0bM=; b=sBnaSfFnG9ATGWv4E4Kyb7qdXMrHMwxLikyqCPuRYwTAmrBRrmaYm3XUYP8GKXsmyb IbTQHrVLH0AFwtpNEnwnbgEOI4vxIQmAXqng1n+PzDBb5Se9EAOZhO202Dgg6PKZIYPT /X/GnJJddxskoe3JL8YhB8asQjDaVPyxiYRb2ZvTBw6IyfBRYqtSW3SNdRIKEHzII9jO aKRQOBM046YZQs/NJdzjO4iLTbk+7A0zZnVaFhyw0lP6yoD3zzZ02f0TOoI6zf4XdgQO myZBBIUSWfyrPK2pgFP6qmLWoqq2ADE2/YIA2FgwLTkFtq+fIho7l40fNK782KUM3Oxv jmWg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020a056a0016d400b0053e8981932esi19901255pfc.330.2022.10.06.09.24.21; Thu, 06 Oct 2022 09:24:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230056AbiJFQUn (ORCPT + 99 others); Thu, 6 Oct 2022 12:20:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231415AbiJFQUg (ORCPT ); Thu, 6 Oct 2022 12:20:36 -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 AD799A3476 for ; Thu, 6 Oct 2022 09:20:33 -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 69A29B8210A for ; Thu, 6 Oct 2022 16:20:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C28EC433C1 for ; Thu, 6 Oct 2022 16:20:30 +0000 (UTC) Subject: [PATCH v2 4/9] NFSD: Revert "NFSD: NFSv4 CLOSE should release an nfsd_file immediately" From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Thu, 06 Oct 2022 12:20:30 -0400 Message-ID: <166507323006.1802.14674581806542137035.stgit@manet.1015granger.net> In-Reply-To: <166507275951.1802.13184584115155050247.stgit@manet.1015granger.net> References: <166507275951.1802.13184584115155050247.stgit@manet.1015granger.net> User-Agent: StGit/1.5.dev2+g9ce680a5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,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 This reverts commit 5e138c4a750dc140d881dab4a8804b094bbc08d2. 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. It gets the reference counting wrong, for one thing. 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... Clear the way for implementing that idea. 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(-) 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); } -/** - * 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); } }