Skip to contentSkip to conversation

nfsdctl: ensure autostart honors the default nfs.conf versX.Y settings

PATCH In review Scott Mayhew 2 participants 2 messages Mar 18, 2025 – Mar 19, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nfsdctl: ensure autostart honors the default nfs.conf versX.Y settings

Yongcheng noted that after disabling a versX.Y option in /etc/nfs.conf, and starting nfsd, subsequently commenting out that option and restarting nfsd would not result in it being re-enabled.

Fixes 03b2e2a1 ("nfsdctl: tweak the nfs.conf version handling")
---
 utils/nfsdctl/nfsdctl.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
utils/nfsdctl/nfsdctl.c +12 -0
index 05fecc71..5ea848c9 100644
@@ -1318,6 +1318,18 @@ static int configure_versions(void)
 	bool found_one = false;
 	char tag[20];
 
+	/*
+	 * First apply the default versX.Y settings from nfs.conf.
+	 */
+	update_nfsd_version(3, 0, true);
+	update_nfsd_version(4, 0, true);
+	update_nfsd_version(4, 1, true);
+	update_nfsd_version(4, 2, true);
+
+	/*
+	 * Then apply any versX.Y settings that are explicitly set in
+	 * nfs.conf.
+	 */
 	for (i = 2; i <= 4; ++i) {
 		sprintf(tag, "vers%d", i);
 		if (!conf_get_bool("nfsd", tag, true)) {
Signature · 1 line
2.47.1
#1 lore raw
Quoted 7 lines · Scott Mayhew

Yongcheng noted that after disabling a versX.Y option in /etc/nfs.conf, and starting nfsd, subsequently commenting out that option and restarting nfsd would not result in it being re-enabled.

Fixes 03b2e2a1 ("nfsdctl: tweak the nfs.conf version handling")

Committed... (tag: nfs-utils-2-8-3-rc7)

steved.

Quoted 27 lines
---
  utils/nfsdctl/nfsdctl.c | 12 ++++++++++++
  1 file changed, 12 insertions(+)
utils/nfsdctl/nfsdctl.c +12 -0
index 05fecc71..5ea848c9 100644
@@ -1318,6 +1318,18 @@ static int configure_versions(void)
  	bool found_one = false;
  	char tag[20];
 
+	/*
+	 * First apply the default versX.Y settings from nfs.conf.
+	 */
+	update_nfsd_version(3, 0, true);
+	update_nfsd_version(4, 0, true);
+	update_nfsd_version(4, 1, true);
+	update_nfsd_version(4, 2, true);
+
+	/*
+	 * Then apply any versX.Y settings that are explicitly set in
+	 * nfs.conf.
+	 */
  	for (i = 2; i <= 4; ++i) {
  		sprintf(tag, "vers%d", i);
  		if (!conf_get_bool("nfsd", tag, true)) {