]> www.infradead.org Git - users/jedix/linux-maple.git/commit
nfsd: filecache: drop the list_lru lock during lock gc scans
authorNeilBrown <neilb@suse.de>
Tue, 18 Feb 2025 15:39:37 +0000 (10:39 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 10 Mar 2025 13:11:08 +0000 (09:11 -0400)
commitfbfdc9fc0f66e7877a6d1a6e44c6acac46c5b811
treec583d008199ac460b3a28f2629d743f7729d107f
parent56221b42d71781e49dcead6ed34b0766daecf90d
nfsd: filecache: drop the list_lru lock during lock gc scans

Under a high NFSv3 load with lots of different files being accessed,
the LRU list of garbage-collectable files can become quite long.

Asking list_lru_scan_node() to scan the whole list can result in a long
period during which a spinlock is held, blocking the addition of new LRU
items.

So ask list_lru_scan_node() to scan only a few entries at a time, and
repeat until the scan is complete.

If the shrinker runs between two consecutive calls of
list_lru_scan_node() it could invalidate the "remaining" counter which
could lead to premature freeing.  So add a spinlock to avoid that.

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