diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index b3e1ec3a362..6d006c063d8 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -5607,6 +5607,8 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata, glusterd_brickinfo_t *brickinfo = NULL; glusterd_volinfo_t *volinfo = NULL; xlator_t *this = NULL; + int32_t pid = -1; + char pidfile[PATH_MAX] = {0}; brickid = mydata; if (!brickid) @@ -5707,6 +5709,29 @@ __glusterd_brick_rpc_notify (struct rpc_clnt *rpc, void *mydata, "peer=%s;volume=%s;brick=%s", brickinfo->hostname, volinfo->volname, brickinfo->path); + /* In case of an abrupt shutdown of a brick PMAP_SIGNOUT + * event is not received by glusterd which can lead to a + * stale port entry in glusterd, so forcibly clean up + * the same if the process is not running + */ + GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, + brickinfo, conf); + if (!gf_is_service_running (pidfile, &pid)) { + ret = pmap_registry_remove ( + THIS, brickinfo->port, + brickinfo->path, + GF_PMAP_PORT_BRICKSERVER, + NULL, _gf_true); + if (ret) { + gf_msg (this->name, GF_LOG_WARNING, + GD_MSG_PMAP_REGISTRY_REMOVE_FAIL, + 0, "Failed to remove pmap " + "registry for port %d for " + "brick %s", brickinfo->port, + brickinfo->path); + ret = 0; + } + } } glusterd_set_brick_status (brickinfo, GF_BRICK_STOPPED); |