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)
committerChuck Lever <chuck.lever@oracle.com>
Wed, 26 Apr 2023 13:04:58 +0000 (09:04 -0400)
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 ab37b85..5034944 100644 (file)
@@ -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;