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

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