]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commitdiff
nfsd: report the requested maximum number of threads instead of number running
authorJeff Layton <jlayton@kernel.org>
Thu, 5 Feb 2026 12:59:20 +0000 (07:59 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Tue, 24 Feb 2026 15:27:51 +0000 (10:27 -0500)
The current netlink and /proc interfaces deviate from their traditional
values when dynamic threading is enabled, and there is currently no way
to know what the current setting is. This patch brings the reporting
back in line with traditional behavior.

Make these interfaces report the requested maximum number of threads
instead of the number currently running. Also, update documentation and
comments to reflect that this value represents a maximum and not the
number currently running.

Fixes: d8316b837c2c ("nfsd: add controls to set the minimum number of threads per pool")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Documentation/netlink/specs/nfsd.yaml
fs/nfsd/nfsctl.c
fs/nfsd/nfssvc.c

index badb2fe57c9859c6932c621a589da694782b0272..f87b5a05e5e987a2dfc474468ddadb5e1f935328 100644 (file)
@@ -152,7 +152,7 @@ operations:
             - compound-ops
     -
       name: threads-set
-      doc: set the number of running threads
+      doc: set the maximum number of running threads
       attribute-set: server
       flags: [admin-perm]
       do:
@@ -165,7 +165,7 @@ operations:
             - min-threads
     -
       name: threads-get
-      doc: get the number of running threads
+      doc: get the maximum number of running threads
       attribute-set: server
       do:
         reply:
index b06adb5d5a2e870e3668abe9a7657f38d3eabea5..369da69d5efeba8bfca043f7f47d11a1353279af 100644 (file)
@@ -377,15 +377,15 @@ static ssize_t write_filehandle(struct file *file, char *buf, size_t size)
 }
 
 /*
- * write_threads - Start NFSD, or report the current number of running threads
+ * write_threads - Start NFSD, or report the configured number of threads
  *
  * Input:
  *                     buf:            ignored
  *                     size:           zero
  * Output:
  *     On success:     passed-in buffer filled with '\n'-terminated C
- *                     string numeric value representing the number of
- *                     running NFSD threads;
+ *                     string numeric value representing the configured
+ *                     number of NFSD threads;
  *                     return code is the size in bytes of the string
  *     On error:       return code is zero
  *
@@ -399,8 +399,8 @@ static ssize_t write_filehandle(struct file *file, char *buf, size_t size)
  * Output:
  *     On success:     NFS service is started;
  *                     passed-in buffer filled with '\n'-terminated C
- *                     string numeric value representing the number of
- *                     running NFSD threads;
+ *                     string numeric value representing the configured
+ *                     number of NFSD threads;
  *                     return code is the size in bytes of the string
  *     On error:       return code is zero or a negative errno value
  */
@@ -430,7 +430,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
 }
 
 /*
- * write_pool_threads - Set or report the current number of threads per pool
+ * write_pool_threads - Set or report the configured number of threads per pool
  *
  * Input:
  *                     buf:            ignored
@@ -447,7 +447,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size)
  * Output:
  *     On success:     passed-in buffer filled with '\n'-terminated C
  *                     string containing integer values representing the
- *                     number of NFSD threads in each pool;
+ *                     configured number of NFSD threads in each pool;
  *                     return code is the size in bytes of the string
  *     On error:       return code is zero or a negative errno value
  */
@@ -1657,7 +1657,7 @@ out_unlock:
 }
 
 /**
- * nfsd_nl_threads_get_doit - get the number of running threads
+ * nfsd_nl_threads_get_doit - get the maximum number of running threads
  * @skb: reply buffer
  * @info: netlink metadata and command arguments
  *
@@ -1700,7 +1700,7 @@ int nfsd_nl_threads_get_doit(struct sk_buff *skb, struct genl_info *info)
                        struct svc_pool *sp = &nn->nfsd_serv->sv_pools[i];
 
                        err = nla_put_u32(skb, NFSD_A_SERVER_THREADS,
-                                         sp->sp_nrthreads);
+                                         sp->sp_nrthrmax);
                        if (err)
                                goto err_unlock;
                }
index 0887ee601d3cf5d4f20f1cef388d12e9db992690..4a04208393b823d0b5ef738a614723ecd6dc91a0 100644 (file)
@@ -239,12 +239,13 @@ static void nfsd_net_free(struct percpu_ref *ref)
 
 int nfsd_nrthreads(struct net *net)
 {
-       int rv = 0;
+       int i, rv = 0;
        struct nfsd_net *nn = net_generic(net, nfsd_net_id);
 
        mutex_lock(&nfsd_mutex);
        if (nn->nfsd_serv)
-               rv = nn->nfsd_serv->sv_nrthreads;
+               for (i = 0; i < nn->nfsd_serv->sv_nrpools; ++i)
+                       rv += nn->nfsd_serv->sv_pools[i].sp_nrthrmax;
        mutex_unlock(&nfsd_mutex);
        return rv;
 }
@@ -659,7 +660,7 @@ int nfsd_get_nrthreads(int n, int *nthreads, struct net *net)
 
        if (serv)
                for (i = 0; i < serv->sv_nrpools && i < n; i++)
-                       nthreads[i] = serv->sv_pools[i].sp_nrthreads;
+                       nthreads[i] = serv->sv_pools[i].sp_nrthrmax;
        return 0;
 }