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