From 2c8bd0d9b133b361a7c4181046bcef7b50dd3bac Mon Sep 17 00:00:00 2001 From: Alexander Scheel Date: Jun 26 2017 21:02:12 +0000 Subject: [PATCH 1/2] Prevent error when writing succesful When a write successfully occurs of length 1, goto fail will be triggered after closing fd, extraneously reporting an error. Signed-off-by: Alexander Scheel --- diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c index e69934d..5dcd84e 100644 --- a/proxy/src/gp_init.c +++ b/proxy/src/gp_init.c @@ -171,12 +171,11 @@ void init_proc_nfsd(struct gp_config *cfg) ret = errno; GPDEBUG("Failed to write to %s: %d (%s)\n", LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret)); + close(fd); + goto fail; } close(fd); - if (ret != 0) { - goto fail; - } return; fail: From 114eb618b8fd8e8a22ea55a313ffb7a86f9deb9c Mon Sep 17 00:00:00 2001 From: Alexander Scheel Date: Jun 26 2017 21:04:16 +0000 Subject: [PATCH 2/2] Implements SIGHUP refresh of use-gss-proxy Fixes issue #193. This implementation refuses to re-poke a properly initialized kernel and ignores the contents of the proc file. Signed-off-by: Alexander Scheel --- diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c index 5dcd84e..247bffb 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++) { @@ -155,9 +156,13 @@ void init_proc_nfsd(struct gp_config *cfg) } if (!enabled) { + poked = 0; return; } + if (poked) + return; + fd = open(LINUX_PROC_USE_GSS_PROXY_FILE, O_RDWR); if (fd == -1) { ret = errno; @@ -176,9 +181,11 @@ void init_proc_nfsd(struct gp_config *cfg) } close(fd); + poked = 1; return; fail: + poked = 0; GPDEBUG("Problem with kernel communication! NFS server will not work\n"); } diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c index 9ffec5e..081a360 100644 --- a/proxy/src/gssproxy.c +++ b/proxy/src/gssproxy.c @@ -140,6 +140,8 @@ static void hup_handler(verto_ctx *vctx, verto_ev *ev UNUSED) exit(ret); } + init_proc_nfsd(gpctx->config); + free_config(&old_config); GPDEBUG("New config loaded successfully.\n");