summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-pmap.c
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2017-05-03 12:17:30 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-05-10 14:06:14 +0000
commit25e24c5ab7202d43afa837cf5159e14fe078cc73 (patch)
treea5171de97a4978e0d120bb9ddcefa79a56157507 /xlators/mgmt/glusterd/src/glusterd-pmap.c
parent7287b46042f805d646d7e117c243a1a4fdc61788 (diff)
glusterd: cleanup pidfile on pmap signout
This patch ensures 1. brick pidfile is cleaned up on pmap signout 2. pmap signout evemt is sent for all the bricks when a brick process shuts down. >Reviewed-on: https://review.gluster.org/17168 >Smoke: Gluster Build System <jenkins@build.gluster.org> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> >(cherry picked from commit 3d35e21ffb15713237116d85711e9cd1dda1688a) Change-Id: I7606a60775b484651d4b9743b6037b40323931a2 BUG: 1449004 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17211 Reviewed-by: Prashanth Pai <ppai@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-pmap.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-pmap.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c
index 8c4174a3642..c3f5dbc3cd1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-pmap.c
+++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c
@@ -521,11 +521,20 @@ gluster_pmap_signin (rpcsvc_request_t *req)
int
__gluster_pmap_signout (rpcsvc_request_t *req)
{
- pmap_signout_req args = {0,};
- pmap_signout_rsp rsp = {0,};
- int ret = -1;
- char brick_path[PATH_MAX] = {0,};
- glusterd_brickinfo_t *brickinfo = NULL;
+ pmap_signout_req args = {0,};
+ pmap_signout_rsp rsp = {0,};
+ int ret = -1;
+ xlator_t *this = NULL;
+ glusterd_conf_t *conf = NULL;
+ glusterd_volinfo_t *volinfo = NULL;
+ glusterd_brickinfo_t *brickinfo = NULL;
+ char pidfile[PATH_MAX] = {0};
+ char brick_path[PATH_MAX] = {0,};
+
+ this = THIS;
+ GF_VALIDATE_OR_GOTO ("glusterd", this, fail);
+ conf = this->private;
+ GF_VALIDATE_OR_GOTO (this->name, conf, fail);
ret = xdr_to_generic (req->msg[0], &args,
(xdrproc_t)xdr_pmap_signout_req);
@@ -544,6 +553,18 @@ __gluster_pmap_signout (rpcsvc_request_t *req)
brick_path, GF_PMAP_PORT_BRICKSERVER,
req->trans);
}
+ /* Clean up the pidfile for this brick given glusterfsd doesn't clean it
+ * any more. This is required to ensure we don't end up with having
+ * stale pid files in case a brick is killed from the backend
+ */
+ ret = glusterd_get_volinfo_from_brick (args.brick, &volinfo);
+ if (!ret) {
+ if (volinfo && brickinfo) {
+ GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo,
+ conf);
+ sys_unlink (pidfile);
+ }
+ }
fail:
glusterd_submit_reply (req, &rsp, NULL, 0, NULL,