summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawa@redhat.com>2017-05-08 19:29:22 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-05-10 14:05:52 +0000
commit7287b46042f805d646d7e117c243a1a4fdc61788 (patch)
tree8d6897493b7f54479e0c7cae601d3d817c9f4aa3 /libglusterfs
parentc72ac23fdc1d41c3a01d20bbad802e7dc7f21c2f (diff)
glusterd: socketfile & pidfile related fixes for brick multiplexing feature
Problem: While brick-muliplexing is on after restarting glusterd, CLI is not showing pid of all brick processes in all volumes. Solution: While brick-mux is on all local brick process communicated through one UNIX socket but as per current code (glusterd_brick_start) it is trying to communicate with separate UNIX socket for each volume which is populated based on brick-name and vol-name.Because of multiplexing design only one UNIX socket is opened so it is throwing poller error and not able to fetch correct status of brick process through cli process. To resolve the problem write a new function glusterd_set_socket_filepath_for_mux that will call by glusterd_brick_start to validate about the existence of socketpath. To avoid the continuous EPOLLERR erros in logs update socket_connect code. Test: To reproduce the issue followed below steps 1) Create two distributed volumes(dist1 and dist2) 2) Set cluster.brick-multiplex is on 3) kill glusterd 4) run command gluster v status After apply the patch it shows correct pid for all volumes > BUG: 1444596 > Change-Id: I5d10af69dea0d0ca19511f43870f34295a54a4d2 > Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> > Reviewed-on: https://review.gluster.org/17101 > Smoke: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Prashanth Pai <ppai@redhat.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Atin Mukherjee <amukherj@redhat.com> > (cherry picked from commit 21c7f7baccfaf644805e63682e5a7d2a9864a1e6) Change-Id: Ia95b9d36e50566b293a8d6350f8316dafc27033b BUG: 1449004 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com> Reviewed-on: https://review.gluster.org/17212 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Prashanth Pai <ppai@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/common-utils.c28
-rw-r--r--libglusterfs/src/common-utils.h3
2 files changed, 21 insertions, 10 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index 2acd83f36cf..6ea4fd14374 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -3633,6 +3633,24 @@ gf_skip_header_section (int fd, int header_len)
return ret;
}
+/* Below function is use to check at runtime if pid is running */
+
+gf_boolean_t
+gf_is_pid_running (int pid)
+{
+ char fname[32] = {0,};
+
+ snprintf(fname, sizeof(fname), "/proc/%d/cmdline", pid);
+
+ if (sys_access (fname , R_OK) != 0) {
+ return _gf_false;
+ }
+
+ return _gf_true;
+
+}
+
+
gf_boolean_t
gf_is_service_running (char *pidfile, int *pid)
{
@@ -3661,15 +3679,7 @@ gf_is_service_running (char *pidfile, int *pid)
*pid = -1;
}
- if (!*pid) {
- /*
- * PID 0 means we've started the process, but it hasn't gotten
- * far enough to put in a real PID yet. More details are in
- * glusterd_brick_start.
- */
- running = _gf_true;
- }
-
+ running = gf_is_pid_running (*pid);
out:
if (file)
fclose (file);
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
index 67baa852c45..6243732b522 100644
--- a/libglusterfs/src/common-utils.h
+++ b/libglusterfs/src/common-utils.h
@@ -821,7 +821,8 @@ int gf_thread_create (pthread_t *thread, const pthread_attr_t *attr,
void *(*start_routine)(void *), void *arg);
int gf_thread_create_detached (pthread_t *thread,
void *(*start_routine)(void *), void *arg);
-
+gf_boolean_t
+gf_is_pid_running (int pid);
gf_boolean_t
gf_is_service_running (char *pidfile, int *pid);
gf_boolean_t