]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nfsd: add some comments to nfsd_file_do_acquire
authorJeff Layton <jlayton@kernel.org>
Thu, 5 Jan 2023 12:15:12 +0000 (07:15 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:27 +0000 (16:19 +0200)
[ 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>
fs/nfsd/filecache.c

index 43bb2fd47cf58c10cda0a60e09f8001bc36e28f7..faa0c7d0253ebfd5ae48a8b1b47a229f73c5dfc2 100644 (file)
@@ -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;