diff mbox series

[RFC,10/30] NFSD: Report filecache item construction failures

Message ID 165590723207.75778.6796494140785317184.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 III June 22, 2022, 2:13 p.m. UTC
My guess is this is exceptionally rare, but it's worth reporting
to see how nfsd_file_acquire() behaves when the cache is full.

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

Patch

diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c
index cae7fa2343c1..a2a78163bf8d 100644
--- a/fs/nfsd/filecache.c
+++ b/fs/nfsd/filecache.c
@@ -47,6 +47,7 @@  static DEFINE_PER_CPU(unsigned long, nfsd_file_acquisitions);
 static DEFINE_PER_CPU(unsigned long, nfsd_file_releases);
 static DEFINE_PER_CPU(unsigned long, nfsd_file_pages_flushed);
 static DEFINE_PER_CPU(unsigned long, nfsd_file_evictions);
+static DEFINE_PER_CPU(unsigned long, nfsd_file_cons_fails);
 
 struct nfsd_fcache_disposal {
 	struct work_struct work;
@@ -975,6 +976,7 @@  nfsd_do_file_acquire(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
 	/* Did construction of this file fail? */
 	if (!test_bit(NFSD_FILE_HASHED, &nf->nf_flags)) {
+		this_cpu_inc(nfsd_file_cons_fails);
 		if (!retry) {
 			status = nfserr_jukebox;
 			goto out;
@@ -1098,7 +1100,7 @@  nfsd_file_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
 static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
 {
 	unsigned long releases = 0, pages_flushed = 0, evictions = 0;
-	unsigned long hits = 0, acquisitions = 0;
+	unsigned long hits = 0, acquisitions = 0, cons_fails = 0;
 	unsigned int i, count = 0, longest = 0;
 
 	/*
@@ -1121,6 +1123,7 @@  static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
 		releases += per_cpu(nfsd_file_releases, i);
 		evictions += per_cpu(nfsd_file_evictions, i);
 		pages_flushed += per_cpu(nfsd_file_pages_flushed, i);
+		cons_fails += per_cpu(nfsd_file_cons_fails, i);
 	}
 
 	seq_printf(m, "total entries: %u\n", count);
@@ -1136,6 +1139,7 @@  static int nfsd_file_cache_stats_show(struct seq_file *m, void *v)
 	else
 		seq_printf(m, "mean age (ms): -\n");
 	seq_printf(m, "pages flushed: %lu\n", pages_flushed);
+	seq_printf(m, "cons fails:    %lu\n", cons_fails);
 	return 0;
 }