Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp6477186rwi; Tue, 18 Oct 2022 12:59:42 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46kXAUv24bPn5s7RbLoC/TBq2NzYbfI/oGDflz6/mi/IQ5F3zCEYiNn5HEianVyisjq9nY X-Received: by 2002:a17:906:3852:b0:78d:b3d2:97a9 with SMTP id w18-20020a170906385200b0078db3d297a9mr3625821ejc.565.1666123182753; Tue, 18 Oct 2022 12:59:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666123182; cv=none; d=google.com; s=arc-20160816; b=ux7RJ8X06IhXyZ2LBLG1WtMQHMJL8dA+vrMqhHT+2uAIm+418EtoHYRDlZyaS0YiUg MXein90wcnP7IWihLIeztUk23v05jRnPhidS2rq5uxOl8A8S9yh3mD6jp7TrxNDkVLFs pjoi1F9IM/E+uwj+tnEt52EUT9wv7tEQE2vb9aNZ6P1WsEnD+OcgbQomkhNi6xo1mJ5z d1R0D7B1HSgxnnxi4HTZ8Oo5/ouChqGadUROF9UKV20xevy5B8lNevzt40xUfnXqV9xr lVkvB3dWCMnvf1xFYklD5BdRwGrOOUNXi+SdtazJ17/0DpXQLZO68UvrtSqRVMTHUQOk tE+A== 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=fhBg9Qg5jr7JTcDhMEndWRmeshh8mBa14i4EAjDz0bM=; b=WbJgRcil+8g3BWbNHCXsi/SqErVJkDyjEDjVo+K/UyOTFnk9c55G4QhWNKXwMiMt2m clNUYrT31987zAk7/+30WE/3Sl/hJesN2LQWGMU6m6/pWjPesMLTcH3VxICp/r2uW12v eX+ggshRAenxrhzC9dgBjze98DIuPCrl9PwZspxVSliDt3JKnQ8k50jS8sTS8orWl3rs xriSXwen8wkTpX3xqgSrt0xi6MfgkdXsB2wurhqjf8Sjfc7/4WT2fafBT2J0oPFg8TSB aYA1CvYcudZy2a34N++FnaWtjuYhni+6diA+tHZAOMRYo+rSqvmb3+B75PqsRqFiH5xw 7iCg== 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 hr2-20020a1709073f8200b007919b3ad78esi2976526ejc.495.2022.10.18.12.59.17; Tue, 18 Oct 2022 12:59:42 -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 S229980AbiJRT6l (ORCPT + 99 others); Tue, 18 Oct 2022 15:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229944AbiJRT6j (ORCPT ); Tue, 18 Oct 2022 15:58:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 134D490801 for ; Tue, 18 Oct 2022 12:58:35 -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 68BCFB82102 for ; Tue, 18 Oct 2022 19:58:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB5F8C433C1; Tue, 18 Oct 2022 19:58:32 +0000 (UTC) Subject: [PATCH v4 2/7] 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: Tue, 18 Oct 2022 15:58:32 -0400 Message-ID: <166612311196.1291.3976661000746956975.stgit@manet.1015granger.net> In-Reply-To: <166612295223.1291.11761205673682408148.stgit@manet.1015granger.net> References: <166612295223.1291.11761205673682408148.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); } }