]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
nfsd: NFSD_FILE_KEY_INODE only needs to find GC'ed entries
authorJeff Layton <jlayton@kernel.org>
Fri, 6 Jan 2023 15:39:00 +0000 (10:39 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:27 +0000 (16:19 +0200)
[ Upstream commit 6c31e4c98853a4ba47355ea151b36a77c42b7734 ]

Since v4 files are expected to be long-lived, there's little value in
closing them out of the cache when there is conflicting access.

Change the comparator to also match the gc value in the key. Change both
of the current users of that key to set the gc value in the key to
"true".

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c

index 677a8d935ccc2cb957c412c6034d41d6e6f6d0e7..4ddc82b84f7c4809638f44361f65498394cd4aa2 100644 (file)
@@ -174,6 +174,8 @@ static int nfsd_file_obj_cmpfn(struct rhashtable_compare_arg *arg,
 
        switch (key->type) {
        case NFSD_FILE_KEY_INODE:
+               if (test_bit(NFSD_FILE_GC, &nf->nf_flags) != key->gc)
+                       return 1;
                if (nf->nf_inode != key->inode)
                        return 1;
                break;
@@ -694,6 +696,7 @@ nfsd_file_queue_for_close(struct inode *inode, struct list_head *dispose)
        struct nfsd_file_lookup_key key = {
                .type   = NFSD_FILE_KEY_INODE,
                .inode  = inode,
+               .gc     = true,
        };
        struct nfsd_file *nf;
 
@@ -1048,6 +1051,7 @@ nfsd_file_is_cached(struct inode *inode)
        struct nfsd_file_lookup_key key = {
                .type   = NFSD_FILE_KEY_INODE,
                .inode  = inode,
+               .gc     = true,
        };
        bool ret = false;