summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Layton <jlayton@kernel.org>2023-01-05 07:15:12 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-21 14:54:13 +0200
commitc3677c14b3d4fc7e537d8a2dfc2f6c96732fd8a7 (patch)
treeefe64b38ec60ddde2044d478a6f89218845a3b56
parentc9e8ed6efabe6580dbf6c6d6477d5b2dec4a4ec8 (diff)
downloadlinux-c3677c14b3d4fc7e537d8a2dfc2f6c96732fd8a7.tar.gz
linux-c3677c14b3d4fc7e537d8a2dfc2f6c96732fd8a7.tar.bz2
linux-c3677c14b3d4fc7e537d8a2dfc2f6c96732fd8a7.zip
nfsd: add some comments to nfsd_file_do_acquire
[ Upstream commit b680cb9b737331aad271feebbedafb865504e234 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-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 43bb2fd47cf5..faa0c7d0253e 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -1093,6 +1093,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;