diff options
author | Samikshan Bairagya <samikshan@gmail.com> | 2017-02-20 18:35:01 +0530 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2017-02-27 17:59:03 -0500 |
commit | 1e3538baab7abc29ac329c78182b62558da56d98 (patch) | |
tree | 755f457ce06f6291ed26fcbfec974b572c46bfd9 /glusterfsd/src | |
parent | dbdfe6c353060b7af7b4250c8d6c30ed0c35783c (diff) |
core: Clean up pmap registry up correctly on volume/brick stop
This commit changes the following:
1. In glusterfs_handle_terminate, send out individual pmap signout
requests to glusterd for every brick.
2. Add another parameter to glusterfs_mgmt_pmap_signout function to
pass the brickname that needs to be removed from the pmap registry.
3. Make sure pmap_registry_search doesn't break out from the loop
iterating over the list of bricks per port if the first brick entry
corresponding to a port is whitespaced out.
4. Make sure the pmap registry entries are removed for other
daemons like snapd.
Change-Id: I69949874435b02699e5708dab811777ccb297174
BUG: 1421590
Signed-off-by: Samikshan Bairagya <samikshan@gmail.com>
Reviewed-on: https://review.gluster.org/16689
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: Gaurav Yadav <gyadav@redhat.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'glusterfsd/src')
-rw-r--r-- | glusterfsd/src/glusterfsd-mgmt.c | 15 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 2 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.h | 2 |
3 files changed, 13 insertions, 6 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 57f8dc0405c..6871582abb0 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -234,6 +234,7 @@ glusterfs_handle_terminate (rpcsvc_request_t *req) gf_log (THIS->name, GF_LOG_INFO, "terminating after loss of last child %s", xlator_req.name); + glusterfs_mgmt_pmap_signout (glusterfsd_ctx, xlator_req.name); cleanup_and_exit (SIGTERM); } else { /* @@ -246,6 +247,8 @@ glusterfs_handle_terminate (rpcsvc_request_t *req) gf_log (THIS->name, GF_LOG_INFO, "detaching not-only child %s", xlator_req.name); top->notify (top, GF_EVENT_TRANSPORT_CLEANUP, victim); + glusterfs_mgmt_pmap_signout (glusterfsd_ctx, xlator_req.name); + *trav_p = (*trav_p)->next; glusterfs_autoscale_threads (THIS->ctx, -1); } @@ -2563,7 +2566,7 @@ out: int -glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx) +glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx, char *brickname) { int ret = 0; pmap_signout_req req = {0, }; @@ -2574,7 +2577,7 @@ glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx) frame = create_frame (THIS, ctx->pool); cmd_args = &ctx->cmd_args; - if (!cmd_args->brick_port || !cmd_args->brick_name) { + if (!cmd_args->brick_port && (!cmd_args->brick_name || !brickname)) { gf_log ("fsd-mgmt", GF_LOG_DEBUG, "portmapper signout arguments not given"); goto out; @@ -2585,8 +2588,12 @@ glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx) snprintf (brick_name, sizeof(brick_name), "%s.rdma", cmd_args->brick_name); req.brick = brick_name; - } else - req.brick = cmd_args->brick_name; + } else { + if (brickname) + req.brick = brickname; + else + req.brick = cmd_args->brick_name; + } req.port = cmd_args->brick_port; req.rdma_port = cmd_args->brick_port2; diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index f402246e78e..e3699739c07 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -1332,7 +1332,7 @@ cleanup_and_exit (int signum) return; ctx->cleanup_started = 1; - glusterfs_mgmt_pmap_signout (ctx); + 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 diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index e442bede5db..6a30ee9e3f7 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -109,7 +109,7 @@ struct _gfd_vol_top_priv_t { }; typedef struct _gfd_vol_top_priv_t gfd_vol_top_priv_t; -int glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx); +int glusterfs_mgmt_pmap_signout (glusterfs_ctx_t *ctx, char *brick_name); int glusterfs_mgmt_pmap_signin (glusterfs_ctx_t *ctx); int glusterfs_volfile_fetch (glusterfs_ctx_t *ctx); void cleanup_and_exit (int signum); |