summaryrefslogtreecommitdiff
path: root/fs/nfsd/filecache.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2023-01-05 15:15:12 +0300
committerChuck Lever <chuck.lever@oracle.com>2023-04-26 16:04:58 +0300
commitb680cb9b737331aad271feebbedafb865504e234 (patch)
tree191ab7e74531212174201ae6ff3ba3c16716dd4c /fs/nfsd/filecache.c
parentc6593366c0bf222be9c7561354dfb921c611745e (diff)
downloadlinux-b680cb9b737331aad271feebbedafb865504e234.tar.xz
nfsd: add some comments to nfsd_file_do_acquire
David Howells mentioned that he found this bit of code confusing, so sprinkle in some comments to clarify. Reported-by: David Howells <dhowells@redhat.com> Signed-off-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'fs/nfsd/filecache.c')
-rw-r--r--fs/nfsd/filecache.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index ab37b85b7207..50349449a4e5 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -1094,6 +1094,11 @@ retry:
rcu_read_unlock();
if (nf) {
+ /*
+ * If the nf is on the LRU then it holds an extra reference
+ * that must be put if it's removed. It had better not be
+ * the last one however, since we should hold another.
+ */
if (nfsd_file_lru_remove(nf))
WARN_ON_ONCE(refcount_dec_and_test(&nf->nf_ref));
goto wait_for_construction;