[nfs-utils PATCH 3/3] mountd/exportd: disable netlink when falling back to /proc
Scott Mayhew <[email protected]>
| Newsgroups | gmane.linux.nfs |
|---|---|
| Message-ID | <[email protected]> |
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. Signed-off-by: Scott Mayhew <[email protected]> --- support/export/cache.c | 7 +++++++ support/export/cache_flush.c | 1 + 2 files changed, 8 insertions(+) diff --git a/support/export/cache.c b/support/export/cache.c index 65008f51..059f48a7 100644 --- a/support/export/cache.c +++ b/support/export/cache.c @@ -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++ ) { diff --git a/support/export/cache_flush.c b/support/export/cache_flush.c index 2a24dec7..046e6917 100644 --- a/support/export/cache_flush.c +++ b/support/export/cache_flush.c @@ -164,5 +164,6 @@ cache_flush(void) return; } /* Fallback: /proc path */ + no_netlink = 1; cache_proc_flush(); } -- 2.55.0