[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240605193446.GW791188@kernel.org>
Date: Wed, 5 Jun 2024 20:34:46 +0100
From: Simon Horman <horms@...nel.org>
To: Jeff Layton <jlayton@...nel.org>
Cc: Chuck Lever <chuck.lever@...cle.com>, Neil Brown <neilb@...e.de>,
Olga Kornievskaia <kolga@...app.com>, Dai Ngo <Dai.Ngo@...cle.com>,
Tom Talpey <tom@...pey.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>, linux-nfs@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org
Subject: Re: [PATCH 3/3] nfsd: allow passing in array of thread counts via
netlink
On Tue, Jun 04, 2024 at 05:07:56PM -0400, Jeff Layton wrote:
> Now that nfsd_svc can handle an array of thread counts, fix up the
> netlink threads interface to construct one from the netlink call
> and pass it through so we can start a pooled server the same way we
> would start a normal one.
>
> Note that any unspecified values in the array are considered zeroes,
> so it's possible to shut down a pooled server by passing in a short
> array that has only zeros, or even an empty array.
>
> Signed-off-by: Jeff Layton <jlayton@...nel.org>
...
> @@ -1690,15 +1691,22 @@ int nfsd_nl_threads_set_doit(struct sk_buff *skb, struct genl_info *info)
>
> mutex_lock(&nfsd_mutex);
>
> - nrpools = nfsd_nrpools(net);
> - if (nrpools && count > nrpools)
> - count = nrpools;
> -
> - /* XXX: make this handle non-global pool-modes */
> - if (count > 1)
> + nrpools = max(count, nfsd_nrpools(net));
> + nthreads = kcalloc(nrpools, sizeof(int), GFP_KERNEL);
> + if (!nthreads) {
> + ret = -ENOMEM;
> goto out_unlock;
> + }
> +
> + i = 0;
> + nlmsg_for_each_attr(attr, info->nlhdr, GENL_HDRLEN, rem) {
> + if (nla_type(attr) == NFSD_A_SERVER_THREADS) {
> + total += nthreads[i++] = nla_get_u32(attr);
Hi Jeff,
A minor nit from my side.
Total is set by otherwise unused in this function.
Flagged by clang-18 W=1 allmodconfig builds.
> + if (i >= count)
> + break;
> + }
> + }
>
> - nthreads = nla_get_u32(info->attrs[NFSD_A_SERVER_THREADS]);
> if (info->attrs[NFSD_A_SERVER_GRACETIME] ||
> info->attrs[NFSD_A_SERVER_LEASETIME] ||
> info->attrs[NFSD_A_SERVER_SCOPE]) {
...
Powered by blists - more mailing lists