Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp7600586rwi; Mon, 24 Oct 2022 17:27:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5CtCNHVEqpoy/JVQV5WS22ecKXs8fyoswprwbNDKcbuMG2G3PVvxlMLHkEGTxa34TUeaII X-Received: by 2002:a17:907:728c:b0:78e:2856:7fed with SMTP id dt12-20020a170907728c00b0078e28567fedmr29997412ejc.2.1666657657991; Mon, 24 Oct 2022 17:27:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666657657; cv=none; d=google.com; s=arc-20160816; b=ilXM4JDzysNjUYil5rCHmmXz/C/ToakOHiqa++83N8qOF5gkTE4jS/0I2CYXlCfeNM 7e8CF+UyselGuAW0Dz+GCLMyNycbnC5q0JOBOxgVEn0KEy9cYX4uDf52bCMmi9fjdPC9 Tz3p3qqoGRVBe2eG6C9ZxH1LEEp2QZAVEpbf3P0FO1Zow2/3IEvCjsaO3PymBtcvf8pW wSn900oeT3HY8cFlPiHsQjTOE4Br+1oSMSSbwCefhqJ7omvTEEq8165ii/fXT3jLce2d M6dopnQNNPzKKOk8CqXaEzOyLqvxaLp5NKR1AtVpwhmFBy9jdvZoVpPfQFPzkTiAWf+Q csWw== 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:cc:to:from :subject; bh=HgBt+gdtkW2I2EqPHZPK6Om+ZLDnYCS2jtviYpbtunI=; b=yarHHWPzbRY7nZV/P8KwRcxk6u6ygj8h1tTilWE4BaJ5rPtzag5sf4B/6cpoA6GGsw hxvMq8B3ellPRuZemxSsPiGsihQqzzvjNUrBDjR1N1rcUqEY5Ez0fWDZgz/Y1C/W+AqN 62D8B5koMlTWq6s334nlQg0tXRx5CUFhv4rbpdhsVvLCEHUPtezbRZa74fSvaa06n/h2 LtA2H3+Y/+5Ui/ykRnoI8LBFYNzRhDxQqzSEwuzX4d6lBae0MYKkxNcF5AWKYishifek jbLMMIluddhTcRlteDHrW64NPWCrFs5cSF4W3BZz7oGfzjQ3deJeFyDcwpO/DDkYV0Mv d0qQ== 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 z7-20020a1709063ac700b00780a240cfd7si942867ejd.493.2022.10.24.17.27.14; Mon, 24 Oct 2022 17:27:37 -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 S231234AbiJYARm (ORCPT + 99 others); Mon, 24 Oct 2022 20:17:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbiJYARb (ORCPT ); Mon, 24 Oct 2022 20:17:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D7338E790 for ; Mon, 24 Oct 2022 15:37:08 -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 dfw.source.kernel.org (Postfix) with ESMTPS id AF460615F4 for ; Mon, 24 Oct 2022 22:37:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00F23C433D7; Mon, 24 Oct 2022 22:37:06 +0000 (UTC) Subject: [PATCH v5 02/13] NFSD: Revert "NFSD: NFSv4 CLOSE should release an nfsd_file immediately" From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: neilb@suse.de Date: Mon, 24 Oct 2022 18:37:06 -0400 Message-ID: <166665102602.50761.15135844636687763879.stgit@klimt.1015granger.net> In-Reply-To: <166664935937.50761.7812494396457965637.stgit@klimt.1015granger.net> References: <166664935937.50761.7812494396457965637.stgit@klimt.1015granger.net> User-Agent: StGit/1.5.dev3+g9561319 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 Reviewed-by: Jeff Layton --- 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 29a62db155fb..beb41a507623 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 357832bac736..6b012ea4bd9d 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 4e718500a00c..c829b828b6fd 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -831,9 +831,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); } }