[PATCH nfs-utils 11/17] mountd/exportd: only use /proc interfaces if netlink setup fails

Jeff Layton
2026-03-16T15:17:05Z

Now that all of the exportd upcalls are converted to use netlink,
don't bother opening /proc channel files if that succeeds.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
support/export/cache.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/support/export/cache.c b/support/export/cache.c
index 43cb16079da867e6633b9cc6436689ab0e156e44..19cfbf6594b0a51d85814460f3153add89aa3a8a 100644
--- a/support/export/cache.c
+++ b/support/export/cache.c
@@ -3013,6 +3013,16 @@ void cache_open(void)
{
int i;

+ if (cache_nfsd_nl_open() == 0) {
+ if (cache_sunrpc_nl_open() == 0)
+ return;
+ 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;
+ }
+
for (i=0; cachelist[i].cache_name; i++ ) {
char path[100];
if (!manage_gids && cachelist[i].cache_handle == auth_unix_gid)
@@ -3020,8 +3030,6 @@ void cache_open(void)
sprintf(path, "/proc/net/rpc/%s/channel", cachelist[i].cache_name);
cachelist[i].f = open(path, O_RDWR);
}
- cache_nfsd_nl_open();
- cache_sunrpc_nl_open();
}

/**

--
2.53.0