summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2018-10-27 16:32:05 +0530
committerAmar Tumballi <amarts@redhat.com>2018-11-12 04:09:51 +0000
commit54a5f0a07817098134219aea9414b029013927f3 (patch)
tree80134ca2cbf9eb16ff41f13c2dac9e7a07da088f /glusterfsd
parent28b4096fe484f545ae578dcef040a69acf6205cd (diff)
glusterfsd: Make each multiplexed brick sign in
NOTE: This change will be consumed by brick mux implementation of glusterd2 only. No corresponsing change in glusterd1 has been made. When a multiplexed brick process is shutting down, it sends sign out requests to glusterd for all bricks that it contains. However, sign in request is only sent for a single brick. Consequently, glusterd has to use some tricky means to repopulate pmap registry with information of multiplexed bricks during glusterd restart. This change makes each multiplexed brick send a sign in request to glusterd2 which ensures that glusterd2 can easily repopulate pmap registry with port information. As a bonus, sign in request will now also contain PID of the brick sending the request so that glusterd2 can rely on this instead of having to read/manage brick pidfiles. Change-Id: I409501515bd9a28ee7a960faca080e97cabe5858 updates: bz#1193929 Signed-off-by: Prashanth Pai <ppai@redhat.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index 54b8215c967..9c9cca2060c 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -2832,6 +2832,8 @@ int
glusterfs_mgmt_pmap_signin(glusterfs_ctx_t *ctx)
{
call_frame_t *frame = NULL;
+ xlator_list_t **trav_p;
+ xlator_t *top;
pmap_signin_req req = {
0,
};
@@ -2861,10 +2863,26 @@ glusterfs_mgmt_pmap_signin(glusterfs_ctx_t *ctx)
req.brick = cmd_args->brick_name;
req.port = cmd_args->brick_port;
-
- ret = mgmt_submit_request(&req, frame, ctx, &clnt_pmap_prog, GF_PMAP_SIGNIN,
- mgmt_pmap_signin_cbk,
- (xdrproc_t)xdr_pmap_signin_req);
+ req.pid = (int)getpid(); /* only glusterd2 consumes this */
+
+ if (ctx->active) {
+ top = ctx->active->first;
+ for (trav_p = &top->children; *trav_p; trav_p = &(*trav_p)->next) {
+ req.brick = (*trav_p)->xlator->name;
+ ret = mgmt_submit_request(&req, frame, ctx, &clnt_pmap_prog,
+ GF_PMAP_SIGNIN, mgmt_pmap_signin_cbk,
+ (xdrproc_t)xdr_pmap_signin_req);
+ if (ret < 0) {
+ gf_log(THIS->name, GF_LOG_WARNING,
+ "failed to send sign in request; brick = %s", req.brick);
+ }
+ }
+ } else {
+ ret = mgmt_submit_request(&req, frame, ctx, &clnt_pmap_prog,
+ GF_PMAP_SIGNIN, mgmt_pmap_signin_cbk,
+ (xdrproc_t)xdr_pmap_signin_req);
+ }
+ /* unfortunately, the caller doesn't care about the returned value */
out:
if (need_emancipate && ret < 0)