Blame SOURCES/Make-proc-file-failure-loud-but-nonfatal.patch

472fdf
From 938bd1adc15342e8ebed3d4e135d862e362a619e Mon Sep 17 00:00:00 2001
472fdf
From: Robbie Harwood <rharwood@redhat.com>
472fdf
Date: Thu, 25 May 2017 13:06:17 -0400
472fdf
Subject: [PATCH] Make proc file failure loud but nonfatal
472fdf
472fdf
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
472fdf
Reviewed-by: Simo Sorce <simo@redhat.com>
472fdf
Resolves: #190
472fdf
(cherry picked from commit 4f60bf02a1a68cbb26251e764357b753f80790f3)
472fdf
---
472fdf
 proxy/src/gp_init.c | 34 +++++++++++++++-------------------
472fdf
 1 file changed, 15 insertions(+), 19 deletions(-)
472fdf
472fdf
diff --git a/proxy/src/gp_init.c b/proxy/src/gp_init.c
472fdf
index bb7ba6b..d367f92 100644
472fdf
--- a/proxy/src/gp_init.c
472fdf
+++ b/proxy/src/gp_init.c
472fdf
@@ -144,11 +144,11 @@ void init_proc_nfsd(struct gp_config *cfg)
472fdf
 {
472fdf
     char buf[] = "1";
472fdf
     bool enabled = false;
472fdf
-    int fd, i, ret;
472fdf
+    int fd, ret;
472fdf
 
472fdf
     /* check first if any service enabled kernel support */
472fdf
-    for (i = 0; i < cfg->num_svcs; i++) {
472fdf
-        if (cfg->svcs[i]->kernel_nfsd == true) {
472fdf
+    for (int i = 0; i < cfg->num_svcs; i++) {
472fdf
+        if (cfg->svcs[i]->kernel_nfsd) {
472fdf
             enabled = true;
472fdf
             break;
472fdf
         }
472fdf
@@ -161,30 +161,26 @@ void init_proc_nfsd(struct gp_config *cfg)
472fdf
     fd = open(LINUX_PROC_USE_GSS_PROXY_FILE, O_RDWR);
472fdf
     if (fd == -1) {
472fdf
         ret = errno;
472fdf
-        fprintf(stderr, "GSS-Proxy is not supported by this kernel since "
472fdf
-                "file %s could not be found: %d (%s)\n",
472fdf
-                LINUX_PROC_USE_GSS_PROXY_FILE,
472fdf
-                ret, gp_strerror(ret));
472fdf
-        exit(1);
472fdf
+        GPDEBUG("Kernel doesn't support GSS-Proxy (can't open %s: %d (%s))\n",
472fdf
+                LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret));
472fdf
+        goto fail;
472fdf
     }
472fdf
 
472fdf
     ret = write(fd, buf, 1);
472fdf
     if (ret != 1) {
472fdf
         ret = errno;
472fdf
-        fprintf(stderr, "Failed to write to %s: %d (%s)\n",
472fdf
-                LINUX_PROC_USE_GSS_PROXY_FILE,
472fdf
-                ret, gp_strerror(ret));
472fdf
-        exit(1);
472fdf
+        GPDEBUG("Failed to write to %s: %d (%s)\n",
472fdf
+                LINUX_PROC_USE_GSS_PROXY_FILE, ret, gp_strerror(ret));
472fdf
     }
472fdf
 
472fdf
-    ret = close(fd);
472fdf
-    if (ret == -1) {
472fdf
-        ret = errno;
472fdf
-        fprintf(stderr, "Failed to close %s: %d (%s)\n",
472fdf
-                LINUX_PROC_USE_GSS_PROXY_FILE,
472fdf
-                ret, gp_strerror(ret));
472fdf
-        exit(1);
472fdf
+    close(fd);
472fdf
+    if (ret != 0) {
472fdf
+        goto fail;
472fdf
     }
472fdf
+
472fdf
+    return;
472fdf
+fail:
472fdf
+    GPDEBUG("Problem with kernel communication!  NFS server will not work\n");
472fdf
 }
472fdf
 
472fdf
 void write_pid(void)