diff options
Diffstat (limited to 'queue-6.12/nfsd-use-threads-array-as-is-in-netlink-interface.patch')
-rw-r--r-- | queue-6.12/nfsd-use-threads-array-as-is-in-netlink-interface.patch | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/queue-6.12/nfsd-use-threads-array-as-is-in-netlink-interface.patch b/queue-6.12/nfsd-use-threads-array-as-is-in-netlink-interface.patch new file mode 100644 index 00000000000..96db7c38fc2 --- /dev/null +++ b/queue-6.12/nfsd-use-threads-array-as-is-in-netlink-interface.patch @@ -0,0 +1,58 @@ +From 8ea688a3372e8369dc04395b39b4e71a6d91d4d5 Mon Sep 17 00:00:00 2001 +From: Jeff Layton <jlayton@kernel.org> +Date: Tue, 27 May 2025 20:12:47 -0400 +Subject: nfsd: use threads array as-is in netlink interface + +From: Jeff Layton <jlayton@kernel.org> + +commit 8ea688a3372e8369dc04395b39b4e71a6d91d4d5 upstream. + +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> +Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> +--- + fs/nfsd/nfsctl.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/fs/nfsd/nfsctl.c ++++ b/fs/nfsd/nfsctl.c +@@ -1653,7 +1653,7 @@ out_unlock: + */ + int nfsd_nl_threads_set_doit(struct sk_buff *skb, struct genl_info *info) + { +- int *nthreads, count = 0, nrpools, i, ret = -EOPNOTSUPP, rem; ++ int *nthreads, nrpools = 0, i, ret = -EOPNOTSUPP, rem; + struct net *net = genl_info_net(info); + struct nfsd_net *nn = net_generic(net, nfsd_net_id); + const struct nlattr *attr; +@@ -1665,12 +1665,11 @@ int nfsd_nl_threads_set_doit(struct sk_b + /* count number of SERVER_THREADS values */ + nlmsg_for_each_attr(attr, info->nlhdr, GENL_HDRLEN, rem) { + if (nla_type(attr) == NFSD_A_SERVER_THREADS) +- count++; ++ nrpools++; + } + + mutex_lock(&nfsd_mutex); + +- nrpools = max(count, nfsd_nrpools(net)); + nthreads = kcalloc(nrpools, sizeof(int), GFP_KERNEL); + if (!nthreads) { + ret = -ENOMEM; |