Skip to contentSkip to conversation

mountd netlink fixes

PATCH In review Scott Mayhew 3 participants 6 messages Jul 7 – Jul 11

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

cover mountd netlink fixes

A handful of fixes for some issues I ran into on Fedora Rawhide.

Scott Mayhew (3):
configure: update check of system netlink headers nfs.conf: add no-netlink option to exportd and mountd stanzas mountd/exportd: disable netlink when falling back to /proc

 configure.ac                 | 4 ++--
 nfs.conf                     | 3 +++
 support/export/cache.c       | 7 +++++++
 support/export/cache_flush.c | 1 +
 4 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.55.0
#1 lore raw

PATCH 1/3 configure: update check of system netlink headers

Commit e1401387 ("nfsstat: add netlink support for fetching server statistics") added new symbols to support/include/nfsd_netlink.h that have not yet been added to the kernel headers. Update the check that defines USE_SYSTEM_NFSD_NETLINK_H - otherwise nfsstat will fail to compile.

---
 configure.ac | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
configure.ac +2 -2
index 8ca06fd6..4ca7666d 100644
@@ -259,9 +259,9 @@ AC_CHECK_HEADERS(linux/nfsd_netlink.h)
 AC_DEFINE([HAVE_NFSD_NETLINK], 1,
 	  [Define to 1 if nfsd generic netlink support is available])
 
-# ensure we have the expkey attributes
+# ensure the system netlink headers have the latest features
 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/nfsd_netlink.h>]],
-			                   [[int foo = NFSD_A_EXPKEY_SEQNO;]])],
+			                   [[int foo = NFSD_CMD_SERVER_STATS_GET;]])],
 			   [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>]],
Signature · 1 line
2.55.0
#2 lore raw

PATCH 2/3 nfs.conf: add no-netlink option to exportd and mountd stanzas

In reply to Scott Mayhew

This option was added by commit 60c38383 ("mountd/exportd/exportfs:
add --no-netlink option to disable netlink"), but nfs.conf was not updated.

---
 nfs.conf | 3 +++
 1 file changed, 3 insertions(+)
nfs.conf +3 -0
index 84cc653f..fa12c592 100644
@@ -43,6 +43,8 @@
 # threads=1
 # cache-use-ipaddr=n
 # ttl=1800
+# no-netlink=0
+#
 [mountd]
 # debug="all|auth|call|general|parse"
 # apply-root-cred=n
@@ -55,6 +57,7 @@
 # ha-callout=
 # cache-use-ipaddr=n
 # ttl=1800
+# no-netlink=0
 #
 [nfsdcld]
 # debug=0
Signature · 1 line
2.55.0
#3 lore raw

PATCH 3/3 mountd/exportd: disable netlink when falling back to /proc

In reply to Scott Mayhew

If cache_flush() has to fall back to the /proc interface, then there's a good chance that the netlink interface isn't going to work, so go ahead and disable it.

The netlink interface requires CAP_NET_ADMIN, which requires a policy update on systems running SELinux. If SELinux blocks mountd from using the netlink interface and there's no fallback, then mount requests just hang.

Also, when falling back, close both the sunrpc and the nfsd netlink sockets.

---
 support/export/cache.c       | 7 +++++++
 support/export/cache_flush.c | 1 +
 2 files changed, 8 insertions(+)
support/export/cache.c +7 -0
index 65008f51..059f48a7 100644
@@ -3072,6 +3072,8 @@ void cache_open(void)
 			 * were queued before we opened the socket.
 			 */
 			auth_reload();
+			if (no_netlink)
+				goto fallback;
 			cache_nl_process_export();
 			cache_nl_process_expkey();
 			cache_nl_process_ip_map();
@@ -3079,11 +3081,16 @@ void cache_open(void)
 				cache_nl_process_unix_gid();
 			return;
 		}
+fallback:
 		xlog(L_NOTICE, "sunrpc netlink family unavailable, falling back to /proc");
 		nl_socket_free(nfsd_nl_notify_sock);
 		nfsd_nl_notify_sock = NULL;
 		nl_socket_free(nfsd_nl_cmd_sock);
 		nfsd_nl_cmd_sock = NULL;
+		nl_socket_free(sunrpc_nl_notify_sock);
+		sunrpc_nl_notify_sock = NULL;
+		nl_socket_free(sunrpc_nl_cmd_sock);
+		sunrpc_nl_cmd_sock = NULL;
 	}
 
 	for (i=0; cachelist[i].cache_name; i++ ) {
support/export/cache_flush.c +1 -0
index 2a24dec7..046e6917 100644
@@ -164,5 +164,6 @@ cache_flush(void)
 		return;
 	}
 	/* Fallback: /proc path */
+	no_netlink = 1;
 	cache_proc_flush();
 }
Signature · 1 line
2.55.0
maintainer Reviewed-by on the v1 series
#4 lore raw
In reply to Scott Mayhew
Quoted 7 lines · Scott Mayhew

A handful of fixes for some issues I ran into on Fedora Rawhide.

Scott Mayhew (3):
configure: update check of system netlink headers nfs.conf: add no-netlink option to exportd and mountd stanzas mountd/exportd: disable netlink when falling back to /proc

Quoted 5 lines
 configure.ac                 | 4 ++--
 nfs.conf                     | 3 +++
 support/export/cache.c       | 7 +++++++
 support/export/cache_flush.c | 1 +
 4 files changed, 13 insertions(+), 2 deletions(-)

These all look good to me. Nice work, Scott.

#5 lore raw
In reply to Scott Mayhew
Quoted 7 lines · Scott Mayhew

A handful of fixes for some issues I ran into on Fedora Rawhide.

Scott Mayhew (3):
configure: update check of system netlink headers nfs.conf: add no-netlink option to exportd and mountd stanzas mountd/exportd: disable netlink when falling back to /proc

Quoted 6 lines
  configure.ac                 | 4 ++--
  nfs.conf                     | 3 +++
  support/export/cache.c       | 7 +++++++
  support/export/cache_flush.c | 1 +
  4 files changed, 13 insertions(+), 2 deletions(-)

Committed... (tag: nfs-utils-2-9-2-rc5)

steved.