]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
NFSD: Zero counters when the filecache is re-initialized
authorChuck Lever <chuck.lever@oracle.com>
Fri, 8 Jul 2022 18:24:51 +0000 (14:24 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:19:09 +0000 (16:19 +0200)
[ 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@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/filecache.c

index b9941d4ef20d6d4338a6ad59a56c95e94c1dac3c..60c51a4d8e0d76e8d91bb556b31924d92622c172 100644 (file)
@@ -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