[PATCH v2 20/21] nfsd: reset thread skip index when advancing pools in rpc_status dumpit

From: Jeff Layton

Date: Thu Jun 11 2026 - 16:07:33 EST


When a netlink dump of rpc_status fills the reply buffer, the iterator
saves the pool index in cb->args[0] and the thread index within that pool
in cb->args[1], so the next invocation can resume where it left off.

On resume the thread skip count was applied to every pool, not just the
pool the dump was suspended in. Once the resumed pool was exhausted and the
loop advanced to the next pool, the first cb->args[1] threads of that pool
(and of every pool after it) were still skipped, silently omitting their
rpc_status entries from the dump.

Apply the saved thread index only to the pool matching cb->args[0], and
start every subsequent pool from thread 0.

Fixes: bd9d6a3efa97 ("NFSD: add rpc_status netlink support")
Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
---
fs/nfsd/nfsctl.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
index 720b481bb7ad..a5e328b14e45 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -1527,10 +1527,20 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,

for (i = 0; i < nn->nfsd_serv->sv_nrpools; i++) {
struct svc_rqst *rqstp;
+ long thread_skip = 0;

if (i < cb->args[0]) /* already consumed */
continue;

+ /*
+ * The saved thread index only applies to the pool the dump
+ * was resumed in. Subsequent pools must start from thread 0,
+ * otherwise their first cb->args[1] threads are silently
+ * skipped.
+ */
+ if (i == cb->args[0])
+ thread_skip = cb->args[1];
+
rqstp_index = 0;
list_for_each_entry_rcu(rqstp,
&nn->nfsd_serv->sv_pools[i].sp_all_threads,
@@ -1538,7 +1548,7 @@ int nfsd_nl_rpc_status_get_dumpit(struct sk_buff *skb,
struct nfsd_genl_rqstp genl_rqstp = {};
unsigned int status_counter;

- if (rqstp_index++ < cb->args[1]) /* already consumed */
+ if (rqstp_index++ < thread_skip) /* already consumed */
continue;
/*
* Acquire rq_status_counter before parsing the rqst

--
2.54.0