This is a note to let you know that I've just added the patch titled NFSD: Zero counters when the filecache is re-initialized to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nfsd-zero-counters-when-the-filecache-is-re-initiali.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 44acdd278577721178142f1209072cb230597a36 Author: Chuck Lever <chuck.lever@xxxxxxxxxx> Date: Fri Jul 8 14:24:51 2022 -0400 NFSD: Zero counters when the filecache is re-initialized [ Upstream commit 8b330f78040cbe16cf8029df70391b2a491f17e2 ] If nfsd_file_cache_init() is called after a shutdown, be sure the stat counters are reset. Reviewed-by: Jeff Layton <jlayton@xxxxxxxxxx> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c index b9941d4ef20d6..60c51a4d8e0d7 100644 --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -823,6 +823,8 @@ nfsd_file_cache_shutdown_net(struct net *net) void nfsd_file_cache_shutdown(void) { + int i; + set_bit(NFSD_FILE_SHUTDOWN, &nfsd_file_lru_flags); lease_unregister_notifier(&nfsd_file_lease_notifier); @@ -846,6 +848,15 @@ nfsd_file_cache_shutdown(void) nfsd_file_hashtbl = NULL; destroy_workqueue(nfsd_filecache_wq); nfsd_filecache_wq = NULL; + + for_each_possible_cpu(i) { + per_cpu(nfsd_file_cache_hits, i) = 0; + per_cpu(nfsd_file_acquisitions, i) = 0; + per_cpu(nfsd_file_releases, i) = 0; + per_cpu(nfsd_file_total_age, i) = 0; + per_cpu(nfsd_file_pages_flushed, i) = 0; + per_cpu(nfsd_file_evictions, i) = 0; + } } static bool