Blame SOURCES/Conditionally-reload-kernel-interface-on-SIGHUP.patch

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