public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Steve Dickson <steved@redhat.com>
Cc: Ben Coddington <bcodding@hammerspace.com>,
	 Chuck Lever <chuck.lever@oracle.com>,
	linux-nfs@vger.kernel.org,  Jeff Layton <jlayton@kernel.org>
Subject: [PATCH nfs-utils v2 1/4] nfsdctl: unconditionally enable support for min-threads
Date: Wed, 04 Feb 2026 11:48:22 -0500	[thread overview]
Message-ID: <20260204-minthreads-v2-1-a7eba34201e9@kernel.org> (raw)
In-Reply-To: <20260204-minthreads-v2-0-a7eba34201e9@kernel.org>

I originally had this depend on the system header, but if we maintain
our copy of nfsd_netlink.h in tree, then we can unconditionally compile
in support for the MIN_THREADS option.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 configure.ac                 |  6 ++----
 utils/nfsdctl/nfsd_netlink.h |  2 ++
 utils/nfsdctl/nfsdctl.c      | 16 +---------------
 3 files changed, 5 insertions(+), 19 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5cc1e9186542c975abf200edbef30bc8f6ecb8ee..a65c7837b8cb72eaa2f3dbb89069599c074be4ec 100644
--- a/configure.ac
+++ b/configure.ac
@@ -262,12 +262,10 @@ AC_ARG_ENABLE(nfsdctl,
 		PKG_CHECK_MODULES(LIBNLGENL3, libnl-genl-3.0 >= 3.1)
 		PKG_CHECK_MODULES(LIBREADLINE, readline)
 		AC_CHECK_HEADERS(linux/nfsd_netlink.h)
-		AC_CHECK_DECLS([NFSD_A_SERVER_MIN_THREADS], , ,
-			       [#include <linux/nfsd_netlink.h>])
 
-		# ensure we have the pool-mode commands
+		# ensure we have the MIN_THREADS attribute
 		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/nfsd_netlink.h>]],
-				                   [[int foo = NFSD_CMD_POOL_MODE_GET;]])],
+				                   [[int foo = NFSD_A_SERVER_MIN_THREADS;]])],
 				   [AC_DEFINE([USE_SYSTEM_NFSD_NETLINK_H], 1,
 					      ["Use system's linux/nfsd_netlink.h"])])
 		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/lockd_netlink.h>]],
diff --git a/utils/nfsdctl/nfsd_netlink.h b/utils/nfsdctl/nfsd_netlink.h
index 887cbd12b695f2398c96976ba2d70e68ee0d93c0..e9efbc9e63d83ed25fcd790b7a877c0023638f15 100644
--- a/utils/nfsdctl/nfsd_netlink.h
+++ b/utils/nfsdctl/nfsd_netlink.h
@@ -2,6 +2,7 @@
 /* Do not edit directly, auto-generated from: */
 /*	Documentation/netlink/specs/nfsd.yaml */
 /* YNL-GEN uapi header */
+/* To regenerate run: tools/net/ynl/ynl-regen.sh */
 
 #ifndef _UAPI_LINUX_NFSD_NETLINK_H
 #define _UAPI_LINUX_NFSD_NETLINK_H
@@ -34,6 +35,7 @@ enum {
 	NFSD_A_SERVER_GRACETIME,
 	NFSD_A_SERVER_LEASETIME,
 	NFSD_A_SERVER_SCOPE,
+	NFSD_A_SERVER_MIN_THREADS,
 
 	__NFSD_A_SERVER_MAX,
 	NFSD_A_SERVER_MAX = (__NFSD_A_SERVER_MAX - 1)
diff --git a/utils/nfsdctl/nfsdctl.c b/utils/nfsdctl/nfsdctl.c
index c906a2c8ba6d357e182d341a30610e367e74c093..6b3c98009488d1687e7e751eaed6c4f1d9613d39 100644
--- a/utils/nfsdctl/nfsdctl.c
+++ b/utils/nfsdctl/nfsdctl.c
@@ -324,11 +324,9 @@ static void parse_threads_get(struct genlmsghdr *gnlh)
 		case NFSD_A_SERVER_THREADS:
 			pool_threads[i++] = nla_get_u32(attr);
 			break;
-#if HAVE_DECL_NFSD_A_SERVER_MIN_THREADS
 		case NFSD_A_SERVER_MIN_THREADS:
 			printf("min-threads: %u\n", nla_get_u32(attr));
 			break;
-#endif
 		default:
 			break;
 		}
@@ -546,10 +544,8 @@ static int threads_doit(struct nl_sock *sock, int cmd, int grace, int lease,
 			nla_put_u32(msg, NFSD_A_SERVER_LEASETIME, lease);
 		if (scope)
 			nla_put_string(msg, NFSD_A_SERVER_SCOPE, scope);
-#if HAVE_DECL_NFSD_A_SERVER_MIN_THREADS
 		if (minthreads >= 0)
 			nla_put_u32(msg, NFSD_A_SERVER_MIN_THREADS, minthreads);
-#endif
 		for (i = 0; i < pool_count; ++i)
 			nla_put_u32(msg, NFSD_A_SERVER_THREADS, pool_threads[i]);
 	}
@@ -591,24 +587,16 @@ out:
 static void threads_usage(void)
 {
 	printf("Usage: %s threads { --min-threads=X } [ pool0_count ] [ pool1_count ] ...\n", taskname);
-#if HAVE_DECL_NFSD_A_SERVER_MIN_THREADS
 	printf("    --min-threads= set the minimum thread count per pool to value\n");
-#endif
 	printf("    pool0_count: thread count for pool0, etc...\n");
 	printf("Omit any arguments to show current thread counts.\n");
 }
 
-#if HAVE_DECL_NFSD_A_SERVER_MIN_THREADS
 static const struct option threads_options[] = {
 	{ "help", no_argument, NULL, 'h' },
 	{ "min-threads", required_argument, NULL, 'm' },
 	{ },
 };
-#define THREADS_OPTSTRING "hm:"
-#else
-#define threads_options help_only_options
-#define THREADS_OPTSTRING "h"
-#endif
 
 static int threads_func(struct nl_sock *sock, int argc, char **argv)
 {
@@ -618,12 +606,11 @@ static int threads_func(struct nl_sock *sock, int argc, char **argv)
 	int opt, pools = 0;
 
 	optind = 1;
-	while ((opt = getopt_long(argc, argv, THREADS_OPTSTRING, threads_options, NULL)) != -1) {
+	while ((opt = getopt_long(argc, argv, "hm:", threads_options, NULL)) != -1) {
 		switch (opt) {
 		case 'h':
 			threads_usage();
 			return 0;
-#if HAVE_DECL_NFSD_A_SERVER_MIN_THREADS
 		case 'm':
 			errno = 0;
 			minthreads = strtoul(optarg, NULL, 0);
@@ -632,7 +619,6 @@ static int threads_func(struct nl_sock *sock, int argc, char **argv)
 				return 1;
 			}
 			break;
-#endif
 		}
 	}
 

-- 
2.52.0


  reply	other threads:[~2026-02-04 16:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-04 16:48 [PATCH nfs-utils v2 0/4] nfsdctl: properly handle older kernels that don't support min-threads Jeff Layton
2026-02-04 16:48 ` Jeff Layton [this message]
2026-02-04 16:48 ` [PATCH nfs-utils v2 2/4] nfsdctl: only resolve netlink family names once Jeff Layton
2026-02-04 16:48 ` [PATCH nfs-utils v2 3/4] nfsdctl: query netlink policy before sending the minthreads attribute to kernel Jeff Layton
2026-02-04 16:48 ` [PATCH nfs-utils v2 4/4] nfsdctl: remove unneeded newlines from xlog() format strings Jeff Layton
2026-02-18 14:19 ` [PATCH nfs-utils v2 0/4] nfsdctl: properly handle older kernels that don't support min-threads Jeff Layton
2026-02-18 17:26   ` Steve Dickson
2026-02-18 17:59 ` Benjamin Coddington
2026-02-23 15:19 ` Steve Dickson

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=20260204-minthreads-v2-1-a7eba34201e9@kernel.org \
    --to=jlayton@kernel.org \
    --cc=bcodding@hammerspace.com \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.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