nfsd: use threads array as-is in netlink interface

The old nfsdfs interface for starting a server with multiple pools
handles the special case of a single entry array passed down from
userland by distributing the threads over every NUMA node.

The netlink control interface however constructs an array of length
nfsd_nrpools() and fills any unprovided slots with 0's. This behavior
defeats the special casing that the old interface relies on.

Change nfsd_nl_threads_set_doit() to pass down the array from userland
as-is.

Fixes: 7f5c330b2620 ("nfsd: allow passing in array of thread counts via netlink")
Cc: stable@vger.kernel.org
Reported-by: Mike Snitzer <snitzer@kernel.org>
Closes: https://lore.kernel.org/linux-nfs/aDC-ftnzhJAlwqwh@kernel.org/
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by Jeff Layton and committed by Chuck Lever 8ea688a3 8b3ac9fa

+2 -3
+2 -3
fs/nfsd/nfsctl.c
··· 1611 */ 1612 int nfsd_nl_threads_set_doit(struct sk_buff *skb, struct genl_info *info) 1613 { 1614 - int *nthreads, count = 0, nrpools, i, ret = -EOPNOTSUPP, rem; 1615 struct net *net = genl_info_net(info); 1616 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 1617 const struct nlattr *attr; ··· 1623 /* count number of SERVER_THREADS values */ 1624 nlmsg_for_each_attr(attr, info->nlhdr, GENL_HDRLEN, rem) { 1625 if (nla_type(attr) == NFSD_A_SERVER_THREADS) 1626 - count++; 1627 } 1628 1629 mutex_lock(&nfsd_mutex); 1630 1631 - nrpools = max(count, nfsd_nrpools(net)); 1632 nthreads = kcalloc(nrpools, sizeof(int), GFP_KERNEL); 1633 if (!nthreads) { 1634 ret = -ENOMEM;
··· 1611 */ 1612 int nfsd_nl_threads_set_doit(struct sk_buff *skb, struct genl_info *info) 1613 { 1614 + int *nthreads, nrpools = 0, i, ret = -EOPNOTSUPP, rem; 1615 struct net *net = genl_info_net(info); 1616 struct nfsd_net *nn = net_generic(net, nfsd_net_id); 1617 const struct nlattr *attr; ··· 1623 /* count number of SERVER_THREADS values */ 1624 nlmsg_for_each_attr(attr, info->nlhdr, GENL_HDRLEN, rem) { 1625 if (nla_type(attr) == NFSD_A_SERVER_THREADS) 1626 + nrpools++; 1627 } 1628 1629 mutex_lock(&nfsd_mutex); 1630 1631 nthreads = kcalloc(nrpools, sizeof(int), GFP_KERNEL); 1632 if (!nthreads) { 1633 ret = -ENOMEM;