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

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