Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

nfsd: report the requested maximum number of threads instead of number running

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>

authored by

Jeff Layton and committed by
Chuck Lever
36441017 92978c83

+15 -14
+2 -2
Documentation/netlink/specs/nfsd.yaml
··· 152 152 - compound-ops 153 153 - 154 154 name: threads-set 155 - doc: set the number of running threads 155 + doc: set the maximum number of running threads 156 156 attribute-set: server 157 157 flags: [admin-perm] 158 158 do: ··· 165 165 - min-threads 166 166 - 167 167 name: threads-get 168 - doc: get the number of running threads 168 + doc: get the maximum number of running threads 169 169 attribute-set: server 170 170 do: 171 171 reply:
+9 -9
fs/nfsd/nfsctl.c
··· 377 377 } 378 378 379 379 /* 380 - * write_threads - Start NFSD, or report the current number of running threads 380 + * write_threads - Start NFSD, or report the configured number of threads 381 381 * 382 382 * Input: 383 383 * buf: ignored 384 384 * size: zero 385 385 * Output: 386 386 * On success: passed-in buffer filled with '\n'-terminated C 387 - * string numeric value representing the number of 388 - * running NFSD threads; 387 + * string numeric value representing the configured 388 + * number of NFSD threads; 389 389 * return code is the size in bytes of the string 390 390 * On error: return code is zero 391 391 * ··· 399 399 * Output: 400 400 * On success: NFS service is started; 401 401 * passed-in buffer filled with '\n'-terminated C 402 - * string numeric value representing the number of 403 - * running NFSD threads; 402 + * string numeric value representing the configured 403 + * number of NFSD threads; 404 404 * return code is the size in bytes of the string 405 405 * On error: return code is zero or a negative errno value 406 406 */ ··· 430 430 } 431 431 432 432 /* 433 - * write_pool_threads - Set or report the current number of threads per pool 433 + * write_pool_threads - Set or report the configured number of threads per pool 434 434 * 435 435 * Input: 436 436 * buf: ignored ··· 447 447 * Output: 448 448 * On success: passed-in buffer filled with '\n'-terminated C 449 449 * string containing integer values representing the 450 - * number of NFSD threads in each pool; 450 + * configured number of NFSD threads in each pool; 451 451 * return code is the size in bytes of the string 452 452 * On error: return code is zero or a negative errno value 453 453 */ ··· 1657 1657 } 1658 1658 1659 1659 /** 1660 - * nfsd_nl_threads_get_doit - get the number of running threads 1660 + * nfsd_nl_threads_get_doit - get the maximum number of running threads 1661 1661 * @skb: reply buffer 1662 1662 * @info: netlink metadata and command arguments 1663 1663 * ··· 1700 1700 struct svc_pool *sp = &nn->nfsd_serv->sv_pools[i]; 1701 1701 1702 1702 err = nla_put_u32(skb, NFSD_A_SERVER_THREADS, 1703 - sp->sp_nrthreads); 1703 + sp->sp_nrthrmax); 1704 1704 if (err) 1705 1705 goto err_unlock; 1706 1706 }
+4 -3
fs/nfsd/nfssvc.c
··· 239 239 240 240 int nfsd_nrthreads(struct net *net) 241 241 { 242 - int rv = 0; 242 + int i, rv = 0; 243 243 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 244 244 245 245 mutex_lock(&nfsd_mutex); 246 246 if (nn->nfsd_serv) 247 - rv = nn->nfsd_serv->sv_nrthreads; 247 + for (i = 0; i < nn->nfsd_serv->sv_nrpools; ++i) 248 + rv += nn->nfsd_serv->sv_pools[i].sp_nrthrmax; 248 249 mutex_unlock(&nfsd_mutex); 249 250 return rv; 250 251 } ··· 660 659 661 660 if (serv) 662 661 for (i = 0; i < serv->sv_nrpools && i < n; i++) 663 - nthreads[i] = serv->sv_pools[i].sp_nrthreads; 662 + nthreads[i] = serv->sv_pools[i].sp_nrthrmax; 664 663 return 0; 665 664 } 666 665