diff mbox series

[RFC,11/30] NFSD: Zero counters when the filecache is re-initialized

Message ID 165590723860.75778.13700894228554322207.stgit@manet.1015granger.net (mailing list archive)
State Superseded
Headers show
Series Overhaul NFSD filecache | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Chuck Lever June 22, 2022, 2:13 p.m. UTC
If nfsd_file_cache_init() is called after a shutdown, be sure the
stat counters are reset.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 fs/nfsd/filecache.c |   11 +++++++++++
 1 file changed, 11 insertions(+)
diff mbox series

Patch

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index a2a78163bf8d..0cf2e44e874f 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -832,6 +832,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);
@@ -855,6 +857,15 @@  nfsd_file_cache_shutdown(void)
 	nfsd_file_hashtbl = NULL;
 	destroy_workqueue(nfsd_filecache_wq);
 	nfsd_filecache_wq = NULL;
+
+	for_each_possible_cpu(i) {
+		this_cpu_write(nfsd_file_cache_hits, 0);
+		this_cpu_write(nfsd_file_acquisitions, 0);
+		this_cpu_write(nfsd_file_releases, 0);
+		this_cpu_write(nfsd_file_evictions, 0);
+		this_cpu_write(nfsd_file_pages_flushed, 0);
+		this_cpu_write(nfsd_file_cons_fails, 0);
+	}
 }
 
 static bool