All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: linux-nfs@vger.kernel.org
Cc: neilb@suse.de, jlayton@redhat.com
Subject: [PATCH v7 02/14] NFSD: Revert "NFSD: NFSv4 CLOSE should release an nfsd_file immediately"
Date: Fri, 28 Oct 2022 10:46:44 -0400	[thread overview]
Message-ID: <166696840463.106044.13085937796095110317.stgit@klimt.1015granger.net> (raw)
In-Reply-To: <166696812922.106044.679812521105874329.stgit@klimt.1015granger.net>

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 <chuck.lever@oracle.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: NeilBrown <neilb@suse.de>
---
 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);
 	}
 }
 



  parent reply	other threads:[~2022-10-28 14:47 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 14:46 [PATCH v7 00/14] A course adjustment, for sure Chuck Lever
2022-10-28 14:46 ` [PATCH v7 01/14] NFSD: Pass the target nfsd_file to nfsd_commit() Chuck Lever
2022-10-28 14:46 ` Chuck Lever [this message]
2022-10-28 14:46 ` [PATCH v7 03/14] NFSD: Add an NFSD_FILE_GC flag to enable nfsd_file garbage collection Chuck Lever
2022-10-31 16:32   ` Jeff Layton
2022-10-28 14:46 ` [PATCH v7 04/14] NFSD: Clean up nfs4_preprocess_stateid_op() call sites Chuck Lever
2022-10-28 14:47 ` [PATCH v7 05/14] NFSD: Trace stateids returned via DELEGRETURN Chuck Lever
2022-10-31 16:33   ` Jeff Layton
2022-10-28 14:47 ` [PATCH v7 06/14] NFSD: Trace delegation revocations Chuck Lever
2022-10-28 14:47 ` [PATCH v7 07/14] NFSD: Use const pointers as parameters to fh_ helpers Chuck Lever
2022-10-28 14:47 ` [PATCH v7 08/14] NFSD: Update file_hashtbl() helpers Chuck Lever
2022-10-31 16:33   ` Jeff Layton
2022-10-28 14:47 ` [PATCH v7 09/14] NFSD: Clean up nfsd4_init_file() Chuck Lever
2022-10-31 16:35   ` Jeff Layton
2022-10-28 14:47 ` [PATCH v7 10/14] NFSD: Add a nfsd4_file_hash_remove() helper Chuck Lever
2022-10-31 16:37   ` Jeff Layton
2022-10-28 14:47 ` [PATCH v7 11/14] NFSD: Clean up find_or_add_file() Chuck Lever
2022-10-31 16:43   ` Jeff Layton
2022-10-31 17:28     ` Chuck Lever III
2022-10-31 17:36       ` Jeff Layton
2022-10-31 17:41         ` Chuck Lever III
2022-10-28 14:47 ` [PATCH v7 12/14] NFSD: Refactor find_file() Chuck Lever
2022-10-31 16:50   ` Jeff Layton
2022-10-28 14:47 ` [PATCH v7 13/14] NFSD: Allocate an rhashtable for nfs4_file objects Chuck Lever
2022-10-28 14:48 ` [PATCH v7 14/14] NFSD: Use rhashtable for managing " Chuck Lever
2022-10-31 16:54   ` Jeff Layton
2022-10-31 17:00     ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=166696840463.106044.13085937796095110317.stgit@klimt.1015granger.net \
    --to=chuck.lever@oracle.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.