From: Scott Mayhew <smayhew@redhat.com>
To: steved@redhat.com
Cc: jlayton@kernel.org, yoyang@redhat.com, linux-nfs@vger.kernel.org
Subject: [nfs-utils PATCH v2 2/2] nfsdctl: tweak the nfs.conf version handling
Date: Fri, 10 Jan 2025 15:17:46 -0500 [thread overview]
Message-ID: <20250110201746.869995-3-smayhew@redhat.com> (raw)
In-Reply-To: <20250110201746.869995-1-smayhew@redhat.com>
I noticed I was getting different results when comparing nfsdctl's
config file handling versus rpc.nfsd's.
First, the vers4 config option was being treated as a mask, e.g. if
vers4=n and vers4.2=y then end result was still that all minorversions
were disabled. Change it so that vers4=n would initially toggle off all
minorversions, but individual v4.x=y would turn that minorversion back
on.
Second, don't make assumptions about what default should be passed to
conf_get_bool. Instead, test both possible values and only update the
nfsd_versions array if an option was explicitly specified.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
utils/nfsdctl/nfsdctl.c | 33 +++++++++++++++++++++++++++------
1 file changed, 27 insertions(+), 6 deletions(-)
diff --git a/utils/nfsdctl/nfsdctl.c b/utils/nfsdctl/nfsdctl.c
index 38c22225..49de55ab 100644
--- a/utils/nfsdctl/nfsdctl.c
+++ b/utils/nfsdctl/nfsdctl.c
@@ -1305,13 +1305,34 @@ read_nfsd_conf(void)
static void configure_versions(void)
{
- bool v4 = conf_get_bool("nfsd", "vers4", true);
+ int i, j, max_minor;
+ char tag[20];
+
+ max_minor = get_max_minorversion();
+
+ for (i = 2; i <= 4; ++i) {
+ sprintf(tag, "vers%d", i);
+ if (!conf_get_bool("nfsd", tag, true)) {
+ update_nfsd_version(i, 0, false);
+ if (i == 4)
+ for (j = 0; j <= max_minor; ++j)
+ update_nfsd_version(4, j, false);
+ }
+ if (conf_get_bool("nfsd", tag, false)) {
+ update_nfsd_version(i, 0, true);
+ if (i == 4)
+ for (j = 0; j <= max_minor; ++j)
+ update_nfsd_version(4, j, true);
+ }
+ }
- update_nfsd_version(2, 0, conf_get_bool("nfsd", "vers2", false));
- update_nfsd_version(3, 0, conf_get_bool("nfsd", "vers3", true));
- update_nfsd_version(4, 0, v4 && conf_get_bool("nfsd", "vers4.0", true));
- update_nfsd_version(4, 1, v4 && conf_get_bool("nfsd", "vers4.1", true));
- update_nfsd_version(4, 2, v4 && conf_get_bool("nfsd", "vers4.2", true));
+ for (i = 0; i <= max_minor; ++i) {
+ sprintf(tag, "vers4.%d", i);
+ if (!conf_get_bool("nfsd", tag, true))
+ update_nfsd_version(4, i, false);
+ if (conf_get_bool("nfsd", tag, false))
+ update_nfsd_version(4, i, true);
+ }
}
static void configure_listeners(void)
--
2.45.2
next prev parent reply other threads:[~2025-01-10 20:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 20:17 [nfs-utils PATCH v2 0/2] nfsdctl version handling fixes Scott Mayhew
2025-01-10 20:17 ` [nfs-utils PATCH v2 1/2] nfsdctl: tweak the version subcommand behavior Scott Mayhew
2025-01-10 20:17 ` Scott Mayhew [this message]
2025-01-10 20:26 ` [nfs-utils PATCH v2 0/2] nfsdctl version handling fixes Scott Mayhew
2025-01-11 12:30 ` Jeff Layton
2025-01-13 23:11 ` Scott Mayhew
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=20250110201746.869995-3-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=jlayton@kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.com \
--cc=yoyang@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