From 3d35e21ffb15713237116d85711e9cd1dda1688a Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Wed, 3 May 2017 12:17:30 +0530 Subject: 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. Change-Id: I7606a60775b484651d4b9743b6037b40323931a2 BUG: 1444596 Signed-off-by: Atin Mukherjee Reviewed-on: https://review.gluster.org/17168 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- glusterfsd/src/glusterfsd.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index b5a51e32f2b..5c4bc8113d5 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1302,6 +1302,9 @@ cleanup_and_exit (int signum) { glusterfs_ctx_t *ctx = NULL; xlator_t *trav = NULL; + xlator_t *top; + xlator_t *victim; + xlator_list_t **trav_p; ctx = glusterfsd_ctx; @@ -1331,7 +1334,20 @@ cleanup_and_exit (int signum) return; ctx->cleanup_started = 1; - glusterfs_mgmt_pmap_signout (ctx, NULL); + + /* signout should be sent to all the bricks in case brick mux is enabled + * and multiple brick instances are attached to this process + */ + if (ctx->active) { + top = ctx->active->first; + for (trav_p = &top->children; *trav_p; + trav_p = &(*trav_p)->next) { + victim = (*trav_p)->xlator; + glusterfs_mgmt_pmap_signout (ctx, victim->name); + } + } else { + glusterfs_mgmt_pmap_signout (ctx, NULL); + } /* below part is a racy code where the rpcsvc object is freed. * But in another thread (epoll thread), upon poll error in the -- cgit