From: Jeff Layton Date: Thu, 5 Jan 2023 12:15:12 +0000 (-0500) Subject: nfsd: add some comments to nfsd_file_do_acquire X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b5a439e8b087963bf860bbe3b092c196c6eccf16;p=users%2Fdwmw2%2Flinux.git 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 Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever --- diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index 43bb2fd47cf58..faa0c7d0253eb 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;