Conditionally reload kernel interface on SIGHUP

This commit is contained in:
Robbie Harwood 2017-12-13 13:00:24 -05:00
parent 8e054c1084
commit 834415d109
2 changed files with 64 additions and 1 deletions

View File

@ -0,0 +1,59 @@
From 70d500d0dcc26ff3a87c1dd4bd6ab0c591ed4cf9 Mon Sep 17 00:00:00 2001
From: Alexander Scheel <ascheel@redhat.com>
Date: Mon, 26 Jun 2017 17:04:16 -0400
Subject: [PATCH] Conditionally reload kernel interface on SIGHUP
Signed-off-by: Alexander Scheel <ascheel@redhat.com>
[rharwood@redhat.com: Simplified logic, rewrote commit message]
Reviewed-by: Robbie Harwood <rharwood@redhat.com>
Resolves: #193
Merges: #201
(cherry picked from commit 938af94b8f33c227dcdd6a53ed42de418578d29d)
---
proxy/src/gp_init.c | 4 +++-
proxy/src/gssproxy.c | 3 +++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c
index e69934d..6a2b047 100644
--- a/proxy/src/gp_init.c
+++ b/proxy/src/gp_init.c
@@ -145,6 +145,7 @@ void init_proc_nfsd(struct gp_config *cfg)
char buf[] = "1";
bool enabled = false;
int fd, ret;
+ static int poked = 0;
/* check first if any service enabled kernel support */
for (int i = 0; i < cfg->num_svcs; i++) {
@@ -154,7 +155,7 @@ void init_proc_nfsd(struct gp_config *cfg)
}
}
- if (!enabled) {
+ if (!enabled || poked) {
return;
}
@@ -173,6 +174,7 @@ void init_proc_nfsd(struct gp_config *cfg)
LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret));
}
+ poked = 1;
close(fd);
if (ret != 0) {
goto fail;
diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c
index 94a6a61..5fc4f8d 100644
--- a/proxy/src/gssproxy.c
+++ b/proxy/src/gssproxy.c
@@ -140,6 +140,9 @@ static void hup_handler(verto_ctx *vctx, verto_ev *ev UNUSED)
exit(ret);
}
+ /* conditionally reload kernel interface */
+ init_proc_nfsd(gpctx->config);
+
free_config(&old_config);
GPDEBUG("New config loaded successfully.\n");

View File

@ -1,6 +1,6 @@
Name: gssproxy
Version: 0.7.0
Release: 28%{?dist}
Release: 29%{?dist}
Summary: GSSAPI Proxy
Group: System Environment/Libraries
@ -48,6 +48,7 @@ Patch35: Simplify-setting-NONBLOCK-on-socket.patch
Patch36: Fix-handling-of-non-EPOLLIN-EPOLLOUT-events.patch
Patch37: Fix-error-handling-in-gpm_send_buffer-gpm_recv_buffe.patch
Patch38: Emit-debug-on-queue-errors.patch
Patch39: Conditionally-reload-kernel-interface-on-SIGHUP.patch
### Dependencies ###
Requires: krb5-libs >= 1.12.0
@ -145,6 +146,9 @@ rm -rf %{buildroot}
%systemd_postun_with_restart gssproxy.service
%changelog
* Wed Dec 13 2017 Robbie Harwood <rharwood@redhat.com> - 0.7.0-29
- Conditionally reload kernel interface on SIGHUP
* Tue Dec 12 2017 Robbie Harwood <rharwood@redhat.com> - 0.7.0-28
- Fixup previous