Skip to contentSkip to conversation

mountd: Cleanup how config options are read in

PATCH In review Steve Dickson 2 participants 7 messages Feb 1, 2021 – Feb 8, 2021

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

PATCH 2/2 mountd: Add debug processing from nfs.conf

In reply to Steve Dickson
---
 nfs.conf              | 2 +-
 utils/mountd/mountd.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
nfs.conf +1 -1
index 186a5b19..9fcf1bf0 100644
@@ -30,7 +30,7 @@
 # udp-port=0
 #
 [mountd]
-# debug=0
+# debug="all|auth|call|general|parse"
 # manage-gids=n
 # descriptors=0
 # port=0
utils/mountd/mountd.c +3 -0
index 988e51c5..a480265a 100644
@@ -684,6 +684,9 @@ read_mount_conf(char **argv)
 	if (s && !state_setup_basedir(argv[0], s))
 		exit(1);
 
+	if ((s = conf_get_str("mountd", "debug")) != NULL)
+		xlog_sconfig(s, 1);
+
 	/* NOTE: following uses "nfsd" section of nfs.conf !!!! */
 	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(_rpcprotobits)))
 		NFSCTL_UDPSET(_rpcprotobits);
Signature · 1 line
2.29.2
#0 lore raw

PATCH 1/2 mountd: Cleanup how config options are read in

---
 utils/mountd/mountd.c | 49 +++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 20 deletions(-)
utils/mountd/mountd.c +29 -20
index 07bcdc5a..988e51c5 100644
@@ -661,30 +661,17 @@ get_exportlist(void)
 	return elist;
 }
 
-int
-main(int argc, char **argv)
+int	vers;
+int	port = 0;
+int	descriptors = 0;
+
+inline static void 
+read_mount_conf(char **argv)
 {
-	char	*progname;
 	char	*s;
-	unsigned int listeners = 0;
-	int	foreground = 0;
-	int	port = 0;
-	int	descriptors = 0;
-	int	c;
-	int	vers;
-	struct sigaction sa;
-	struct rlimit rlim;
-
-	/* Set the basename */
-	if ((progname = strrchr(argv[0], '/')) != NULL)
-		progname++;
-	else
-		progname = argv[0];
-
-	/* Initialize logging. */
-	xlog_open(progname);
 
 	conf_init_file(NFS_CONFFILE);
+
 	xlog_from_conffile("mountd");
 	manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
 	descriptors = conf_get_num("mountd", "descriptors", descriptors);
@@ -714,7 +701,29 @@ main(int argc, char **argv)
 		else
 			NFSCTL_VERUNSET(nfs_version, vers);
 	}
+}
+
+int
+main(int argc, char **argv)
+{
+	char	*progname;
+	unsigned int listeners = 0;
+	int	foreground = 0;
+	int	c;
+	struct sigaction sa;
+	struct rlimit rlim;
+
+	/* Set the basename */
+	if ((progname = strrchr(argv[0], '/')) != NULL)
+		progname++;
+	else
+		progname = argv[0];
+
+	/* Initialize logging. */
+	xlog_open(progname);
 
+	/* Read in config setting */
+	read_mount_conf(argv);
 
 	/* Parse the command line options and arguments. */
 	opterr = 0;
Signature · 1 line
2.29.2
#2 lore raw

Re: [PATCH 2/2] mountd: Add debug processing from nfs.conf

In reply to Steve Dickson
Quoted 1 line · Steve Dickson

Committed... (tag: nfs-utils-2-5-3-rc5)

steved.

Quoted 33 lines
---
 nfs.conf              | 2 +-
 utils/mountd/mountd.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
nfs.conf +1 -1
index 186a5b19..9fcf1bf0 100644
@@ -30,7 +30,7 @@
 # udp-port=0
 #
 [mountd]
-# debug=0
+# debug="all|auth|call|general|parse"
 # manage-gids=n
 # descriptors=0
 # port=0
utils/mountd/mountd.c +3 -0
index 988e51c5..a480265a 100644
@@ -684,6 +684,9 @@ read_mount_conf(char **argv)
 	if (s && !state_setup_basedir(argv[0], s))
 		exit(1);
 
+	if ((s = conf_get_str("mountd", "debug")) != NULL)
+		xlog_sconfig(s, 1);
+
 	/* NOTE: following uses "nfsd" section of nfs.conf !!!! */
 	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(_rpcprotobits)))
 		NFSCTL_UDPSET(_rpcprotobits);
#6 lore raw
In reply to Steve Dickson
Quoted 1 line · Steve Dickson

Committed... (tag: nfs-utils-2-5-3-rc5)

steved.

Quoted 77 lines
---
 utils/mountd/mountd.c | 49 +++++++++++++++++++++++++------------------
 1 file changed, 29 insertions(+), 20 deletions(-)
utils/mountd/mountd.c +29 -20
index 07bcdc5a..988e51c5 100644
@@ -661,30 +661,17 @@ get_exportlist(void)
 	return elist;
 }
 
-int
-main(int argc, char **argv)
+int	vers;
+int	port = 0;
+int	descriptors = 0;
+
+inline static void 
+read_mount_conf(char **argv)
 {
-	char	*progname;
 	char	*s;
-	unsigned int listeners = 0;
-	int	foreground = 0;
-	int	port = 0;
-	int	descriptors = 0;
-	int	c;
-	int	vers;
-	struct sigaction sa;
-	struct rlimit rlim;
-
-	/* Set the basename */
-	if ((progname = strrchr(argv[0], '/')) != NULL)
-		progname++;
-	else
-		progname = argv[0];
-
-	/* Initialize logging. */
-	xlog_open(progname);
 
 	conf_init_file(NFS_CONFFILE);
+
 	xlog_from_conffile("mountd");
 	manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
 	descriptors = conf_get_num("mountd", "descriptors", descriptors);
@@ -714,7 +701,29 @@ main(int argc, char **argv)
 		else
 			NFSCTL_VERUNSET(nfs_version, vers);
 	}
+}
+
+int
+main(int argc, char **argv)
+{
+	char	*progname;
+	unsigned int listeners = 0;
+	int	foreground = 0;
+	int	c;
+	struct sigaction sa;
+	struct rlimit rlim;
+
+	/* Set the basename */
+	if ((progname = strrchr(argv[0], '/')) != NULL)
+		progname++;
+	else
+		progname = argv[0];
+
+	/* Initialize logging. */
+	xlog_open(progname);
 
+	/* Read in config setting */
+	read_mount_conf(argv);
 
 	/* Parse the command line options and arguments. */
 	opterr = 0;
reviewer
#3 lore raw

Re: [PATCH 2/2] mountd: Add debug processing from nfs.conf

In reply to Steve Dickson
Quoted 24 lines · Steve Dickson
---
 nfs.conf              | 2 +-
 utils/mountd/mountd.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
nfs.conf +1 -1
index 186a5b19..9fcf1bf0 100644
@@ -30,7 +30,7 @@
 # udp-port=0
 #
 [mountd]
-# debug=0
+# debug="all|auth|call|general|parse"
 # manage-gids=n
 # descriptors=0
 # port=0
utils/mountd/mountd.c +0 -0
index 988e51c5..a480265a 100644

utils/mountd/mountd.c read_mount_conf(char **argv) · line 689

Quoted 6 lines
utils/mountd/mountd.c +3 -0
@@ -684,6 +684,9 @@ read_mount_conf(char **argv)
 	if (s && !state_setup_basedir(argv[0], s))
 		exit(1);
 
+	if ((s = conf_get_str("mountd", "debug")) != NULL)
+		xlog_sconfig(s, 1);
+

Why is this needed?
A few lines higher up is
xlog_from_conffile("mountd");
which calls
kinds = conf_get_list(service, "debug");
and passes each word that it finds to xlog_sconfig() ??

I just tested setting "debug=all" in the mountd section of nfs.conf, and it seems to work without this patch.

Thanks,
NeilBrown

Quoted 5 lines
utils/mountd/mountd.c +0 -0
 	/* NOTE: following uses "nfsd" section of nfs.conf !!!! */
 	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(_rpcprotobits)))
 		NFSCTL_UDPSET(_rpcprotobits);
Signature · 1 line
2.29.2
#4 lore raw

Re: [PATCH 2/2] mountd: Add debug processing from nfs.conf

Quoted 41 lines · NeilBrown
Quoted 24 lines · Steve Dickson
---
 nfs.conf              | 2 +-
 utils/mountd/mountd.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
nfs.conf +1 -1
index 186a5b19..9fcf1bf0 100644
@@ -30,7 +30,7 @@
 # udp-port=0
 #
 [mountd]
-# debug=0
+# debug="all|auth|call|general|parse"
 # manage-gids=n
 # descriptors=0
 # port=0
utils/mountd/mountd.c +0 -0
index 988e51c5..a480265a 100644

utils/mountd/mountd.c read_mount_conf(char **argv) · line 689

Quoted 6 lines
utils/mountd/mountd.c +3 -0
@@ -684,6 +684,9 @@ read_mount_conf(char **argv)
 	if (s && !state_setup_basedir(argv[0], s))
 		exit(1);
 
+	if ((s = conf_get_str("mountd", "debug")) != NULL)
+		xlog_sconfig(s, 1);
+

Why is this needed?
A few lines higher up is
xlog_from_conffile("mountd");
which calls
kinds = conf_get_list(service, "debug");
and passes each word that it finds to xlog_sconfig() ??

Quoted 2 lines

I just tested setting "debug=all" in the mountd section of nfs.conf, and it seems to work without this patch.

No it is not... I didn't realize xlog_from_conffile() process the debug config variable... maybe we should change the name to something like xlog_debug_conffile()... something more descriptive as to what it does.

I will clean it up... in a bit.

steved.

Quoted 10 lines

Thanks,
NeilBrown

Quoted 5 lines
utils/mountd/mountd.c +0 -0
 	/* NOTE: following uses "nfsd" section of nfs.conf !!!! */
 	if (conf_get_bool("nfsd", "udp", NFSCTL_UDPISSET(_rpcprotobits)))
 		NFSCTL_UDPSET(_rpcprotobits);
Signature · 1 line
2.29.2
reviewer
#5 lore raw

Re: [PATCH 2/2] mountd: Add debug processing from nfs.conf

Quoted 42 lines · Steve Dickson
Quoted 41 lines · NeilBrown
Quoted 24 lines · Steve Dickson
---
 nfs.conf              | 2 +-
 utils/mountd/mountd.c | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
nfs.conf +1 -1
index 186a5b19..9fcf1bf0 100644
@@ -30,7 +30,7 @@
 # udp-port=0
 #
 [mountd]
-# debug=0
+# debug="all|auth|call|general|parse"
 # manage-gids=n
 # descriptors=0
 # port=0
utils/mountd/mountd.c +0 -0
index 988e51c5..a480265a 100644

utils/mountd/mountd.c read_mount_conf(char **argv) · line 689

Quoted 6 lines
utils/mountd/mountd.c +3 -0
@@ -684,6 +684,9 @@ read_mount_conf(char **argv)
 	if (s && !state_setup_basedir(argv[0], s))
 		exit(1);
 
+	if ((s = conf_get_str("mountd", "debug")) != NULL)
+		xlog_sconfig(s, 1);
+

Why is this needed?
A few lines higher up is
xlog_from_conffile("mountd");
which calls
kinds = conf_get_list(service, "debug");
and passes each word that it finds to xlog_sconfig() ??

Quoted 8 lines
Quoted 2 lines

I just tested setting "debug=all" in the mountd section of nfs.conf, and it seems to work without this patch.

No it is not... I didn't realize xlog_from_conffile() process the debug config variable... maybe we should change the name to something like xlog_debug_conffile()... something more descriptive as to what it does.

I will clean it up... in a bit.

Thanks. I agree that including "debug" in that function name would help. Maybe "conffile_set_debug()", or your suggestion.

Thanks,
NeilBrown