]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-5.15/nfsd-nfsd_file_key_inode-only-needs-to-find-gc-ed-en.patch
Fixes for 5.15
[thirdparty/kernel/stable-queue.git] / queue-5.15 / nfsd-nfsd_file_key_inode-only-needs-to-find-gc-ed-en.patch
1 From 2746dca85b8d81bd0f0cb8531029dbb3b889e6b9 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Fri, 6 Jan 2023 10:39:00 -0500
4 Subject: nfsd: NFSD_FILE_KEY_INODE only needs to find GC'ed entries
5
6 From: Jeff Layton <jlayton@kernel.org>
7
8 [ Upstream commit 6c31e4c98853a4ba47355ea151b36a77c42b7734 ]
9
10 Since v4 files are expected to be long-lived, there's little value in
11 closing them out of the cache when there is conflicting access.
12
13 Change the comparator to also match the gc value in the key. Change both
14 of the current users of that key to set the gc value in the key to
15 "true".
16
17 Signed-off-by: Jeff Layton <jlayton@kernel.org>
18 Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
19 ---
20 fs/nfsd/filecache.c | 4 ++++
21 1 file changed, 4 insertions(+)
22
23 diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
24 index 677a8d935ccc2..4ddc82b84f7c4 100644
25 --- a/fs/nfsd/filecache.c
26 +++ b/fs/nfsd/filecache.c
27 @@ -174,6 +174,8 @@ static int nfsd_file_obj_cmpfn(struct rhashtable_compare_arg *arg,
28
29 switch (key->type) {
30 case NFSD_FILE_KEY_INODE:
31 + if (test_bit(NFSD_FILE_GC, &nf->nf_flags) != key->gc)
32 + return 1;
33 if (nf->nf_inode != key->inode)
34 return 1;
35 break;
36 @@ -694,6 +696,7 @@ nfsd_file_queue_for_close(struct inode *inode, struct list_head *dispose)
37 struct nfsd_file_lookup_key key = {
38 .type = NFSD_FILE_KEY_INODE,
39 .inode = inode,
40 + .gc = true,
41 };
42 struct nfsd_file *nf;
43
44 @@ -1048,6 +1051,7 @@ nfsd_file_is_cached(struct inode *inode)
45 struct nfsd_file_lookup_key key = {
46 .type = NFSD_FILE_KEY_INODE,
47 .inode = inode,
48 + .gc = true,
49 };
50 bool ret = false;
51
52 --
53 2.43.0
54