From 220d406ad13d840e950eef001a2b36f87570058d Mon Sep 17 00:00:00 2001 From: Gaurav Kumar Garg Date: Wed, 2 Mar 2016 17:42:07 +0530 Subject: glusterd: Gluster should keep PID file in correct location Currently Gluster keeps process pid information of all the daemons and brick processes in Gluster configuration file directory (ie., /var/lib/glusterd/*). These pid files should be seperate from configuration files. Deletion of the configuration file directory might result into serious problems. Also, /var/run/gluster is the default placeholder directory for pid files. So, with this fix Gluster will keep all process pid information of all processes in /var/run/gluster/* directory. Change-Id: Idb09e3fccb6a7355fbac1df31082637c8d7ab5b4 BUG: 1258561 Signed-off-by: Gaurav Kumar Garg Signed-off-by: Saravanakumar Arumugam Reviewed-on: https://review.gluster.org/13580 Tested-by: MOHIT AGRAWAL Smoke: Gluster Build System CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee --- xlators/mgmt/glusterd/src/glusterd-utils.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 3c757d5717f..ee3498f3e86 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1852,7 +1852,7 @@ glusterd_set_brick_socket_filepath (glusterd_volinfo_t *volinfo, priv = this->private; - GLUSTERD_GET_VOLUME_DIR (volume_dir, volinfo, priv); + GLUSTERD_GET_VOLUME_PID_DIR (volume_dir, volinfo, priv); GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, export_path); snprintf (sock_filepath, PATH_MAX, "%s/run/%s-%s", volume_dir, brickinfo->hostname, export_path); @@ -1911,7 +1911,6 @@ out: static int _mk_rundir_p (glusterd_volinfo_t *volinfo) { - char voldir[PATH_MAX] = {0,}; char rundir[PATH_MAX] = {0,}; glusterd_conf_t *priv = NULL; xlator_t *this = NULL; @@ -1919,8 +1918,7 @@ _mk_rundir_p (glusterd_volinfo_t *volinfo) this = THIS; priv = this->private; - GLUSTERD_GET_VOLUME_DIR (voldir, volinfo, priv); - snprintf (rundir, sizeof (rundir)-1, "%s/run", voldir); + GLUSTERD_GET_VOLUME_PID_DIR (rundir, volinfo, priv); ret = mkdir_p (rundir, 0777, _gf_true); if (ret) gf_msg (this->name, GF_LOG_ERROR, errno, @@ -5006,8 +5004,8 @@ glusterd_add_node_to_dict (char *server, dict_t *dict, int count, priv = this->private; GF_ASSERT (priv); - glusterd_svc_build_pidfile_path (server, priv->workdir, pidfile, - sizeof (pidfile)); + glusterd_svc_build_pidfile_path (server, priv->rundir, + pidfile, sizeof (pidfile)); if (strcmp(server, priv->shd_svc.name) == 0) svc = &(priv->shd_svc); @@ -8108,7 +8106,7 @@ glusterd_nfs_statedump (char *options, int option_cnt, char **op_errstr) } GLUSTERD_GET_NFS_DIR (path, conf); - GLUSTERD_GET_NFS_PIDFILE (pidfile_path, path); + GLUSTERD_GET_NFS_PIDFILE (pidfile_path, path, conf); pidfile = fopen (pidfile_path, "r"); if (!pidfile) { @@ -8233,7 +8231,7 @@ glusterd_quotad_statedump (char *options, int option_cnt, char **op_errstr) } GLUSTERD_GET_QUOTAD_DIR (path, conf); - GLUSTERD_GET_QUOTAD_PIDFILE (pidfile_path, path); + GLUSTERD_GET_QUOTAD_PIDFILE (pidfile_path, path, conf); pidfile = fopen (pidfile_path, "r"); if (!pidfile) { -- cgit