From: Simon Horman <horms@kernel.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: Chuck Lever <chuck.lever@oracle.com>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <kolga@netapp.com>,
Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
Anna Schumaker <anna@kernel.org>,
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH 3/3] nfsd: allow passing in array of thread counts via netlink
Date: Wed, 5 Jun 2024 20:34:46 +0100 [thread overview]
Message-ID: <20240605193446.GW791188@kernel.org> (raw)
In-Reply-To: <20240604-nfsd-next-v1-3-8df686ae61de@kernel.org>
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@kernel.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]) {
...
prev parent reply other threads:[~2024-06-05 19:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 21:07 [PATCH 0/3] nfsd/sunrpc: allow starting/stopping pooled NFS server via netlink Jeff Layton
2024-06-04 21:07 ` [PATCH 1/3] sunrpc: fix up the special handling of sv_nrpools == 1 Jeff Layton
2024-06-04 21:07 ` [PATCH 2/3] nfsd: make nfsd_svc call nfsd_set_nrthreads Jeff Layton
2024-06-04 21:07 ` [PATCH 3/3] nfsd: allow passing in array of thread counts via netlink Jeff Layton
2024-06-05 19:34 ` Simon Horman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240605193446.GW791188@kernel.org \
--to=horms@kernel.org \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jlayton@kernel.org \
--cc=kolga@netapp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tom@talpey.com \
--cc=trond.myklebust@hammerspace.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).