Skip to contentSkip to conversation

nfsdctl: debug logging fixups

PATCH In review Scott Mayhew 2 participants 2 messages May 1, 2025 – May 7, 2025

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

PATCH v2 1/1 nfsdctl: debug logging fixups

Move read_nfsd_conf() out of autostart_func() and into main() so we don't lose any messages. Remove hard-coded NFSD_FAMILY_NAME in the first error message in netlink_msg_alloc() so the error message has the correct family and make both error messages in netlink_msg_alloc() more descriptive/unique.

---
SteveD - the original patch was supposed to go on top of Jeff's "nfsdctl: add support for new lockd configuration interface" patches, but seems to have gotten lost in the shuffle. The v2 patch is the same, I've just reworded the commit message a bit.

 utils/nfsdctl/nfsdctl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
utils/nfsdctl/nfsdctl.c +4 -4
index 733756a9..1fdbb44d 100644
@@ -436,7 +436,7 @@ static struct nl_msg *netlink_msg_alloc(struct nl_sock *sock, const char *family
 
 	id = genl_ctrl_resolve(sock, family);
 	if (id < 0) {
-		xlog(L_ERROR, "%s not found", NFSD_FAMILY_NAME);
+		xlog(L_ERROR, "failed to resolve %s generic netlink family", family);
 		return NULL;
 	}
 
@@ -447,7 +447,7 @@ static struct nl_msg *netlink_msg_alloc(struct nl_sock *sock, const char *family
 	}
 
 	if (!genlmsg_put(msg, 0, 0, id, 0, 0, 0, 0)) {
-		xlog(L_ERROR, "failed to allocate netlink message");
+		xlog(L_ERROR, "failed to add generic netlink headers to netlink message");
 		nlmsg_free(msg);
 		return NULL;
 	}
@@ -1592,8 +1592,6 @@ static int autostart_func(struct nl_sock *sock, int argc, char ** argv)
 		}
 	}
 
-	read_nfsd_conf();
-
 	grace = conf_get_num("nfsd", "grace-time", 0);
 	ret = lockd_configure(sock, grace);
 	if (ret) {
@@ -1824,6 +1822,8 @@ int main(int argc, char **argv)
 	xlog_syslog(0);
 	xlog_stderr(1);
 
+	read_nfsd_conf();
+
 	/* Parse the preliminary options */
 	while ((opt = getopt_long(argc, argv, "+hdsV", pre_options, NULL)) != -1) {
 		switch (opt) {
Signature · 1 line
2.48.1
#1 lore raw
Quoted 6 lines · Scott Mayhew

Move read_nfsd_conf() out of autostart_func() and into main() so we don't lose any messages. Remove hard-coded NFSD_FAMILY_NAME in the first error message in netlink_msg_alloc() so the error message has the correct family and make both error messages in netlink_msg_alloc() more descriptive/unique.

Quoted 7 lines

---
SteveD - the original patch was supposed to go on top of Jeff's "nfsdctl: add support for new lockd configuration interface" patches, but seems to have gotten lost in the shuffle. The v2 patch is the same, I've just reworded the commit message a bit.

Not sure what you are talking about... Those nlm patches went in a while ago... What am I missing?

Committed... (tag: nfs-utils-2-8-4-rc1)

steved.

Quoted 44 lines
  utils/nfsdctl/nfsdctl.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
utils/nfsdctl/nfsdctl.c +4 -4
index 733756a9..1fdbb44d 100644
@@ -436,7 +436,7 @@ static struct nl_msg *netlink_msg_alloc(struct nl_sock *sock, const char *family
 
  	id = genl_ctrl_resolve(sock, family);
  	if (id < 0) {
-		xlog(L_ERROR, "%s not found", NFSD_FAMILY_NAME);
+		xlog(L_ERROR, "failed to resolve %s generic netlink family", family);
  		return NULL;
  	}
 
@@ -447,7 +447,7 @@ static struct nl_msg *netlink_msg_alloc(struct nl_sock *sock, const char *family
  	}
 
  	if (!genlmsg_put(msg, 0, 0, id, 0, 0, 0, 0)) {
-		xlog(L_ERROR, "failed to allocate netlink message");
+		xlog(L_ERROR, "failed to add generic netlink headers to netlink message");
  		nlmsg_free(msg);
  		return NULL;
  	}
@@ -1592,8 +1592,6 @@ static int autostart_func(struct nl_sock *sock, int argc, char ** argv)
  		}
  	}
 
-	read_nfsd_conf();
-
  	grace = conf_get_num("nfsd", "grace-time", 0);
  	ret = lockd_configure(sock, grace);
  	if (ret) {
@@ -1824,6 +1822,8 @@ int main(int argc, char **argv)
  	xlog_syslog(0);
  	xlog_stderr(1);
 
+	read_nfsd_conf();
+
  	/* Parse the preliminary options */
  	while ((opt = getopt_long(argc, argv, "+hdsV", pre_options, NULL)) != -1) {
  		switch (opt) {