diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-mgmt.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mgmt.c | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 8e2c0c689..624e3a393 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -351,6 +351,7 @@ glusterd_mgmt_v3_initiate_lockdown (glusterd_conf_t *conf, glusterd_op_t op, } /* Sending Volume lock req to other nodes in the cluster */ + gd_syncargs_init (&args, NULL); synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { @@ -533,6 +534,7 @@ glusterd_mgmt_v3_pre_validate (glusterd_conf_t *conf, glusterd_op_t op, } /* Sending Pre Validation req to other nodes in the cluster */ + gd_syncargs_init (&args, NULL); synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { @@ -732,6 +734,7 @@ glusterd_mgmt_v3_brick_op (glusterd_conf_t *conf, glusterd_op_t op, } /* Sending brick op req to other nodes in the cluster */ + gd_syncargs_init (&args, NULL); synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { @@ -768,6 +771,7 @@ gd_mgmt_v3_commit_cbk_fn (struct rpc_req *req, struct iovec *iov, call_frame_t *frame = NULL; int op_ret = -1; int op_errno = -1; + dict_t *rsp_dict = NULL; GF_ASSERT(req); GF_ASSERT(iov); @@ -789,7 +793,32 @@ gd_mgmt_v3_commit_cbk_fn (struct rpc_req *req, struct iovec *iov, if (ret < 0) goto out; + if (rsp.dict.dict_len) { + /* Unserialize the dictionary */ + rsp_dict = dict_new (); + + ret = dict_unserialize (rsp.dict.dict_val, + rsp.dict.dict_len, + &rsp_dict); + if (ret < 0) { + GF_FREE (rsp.dict.dict_val); + goto out; + } else { + rsp_dict->extra_stdfree = rsp.dict.dict_val; + } + } + uuid_copy (args->uuid, rsp.uuid); + pthread_mutex_lock (&args->lock_dict); + { + ret = glusterd_syncop_aggr_rsp_dict (rsp.op, args->dict, + rsp_dict); + if (ret) + gf_log ("", GF_LOG_ERROR, "%s", + "Failed to aggregate response from " + " node/brick"); + } + pthread_mutex_unlock (&args->lock_dict); op_ret = rsp.op_ret; op_errno = rsp.op_errno; @@ -846,7 +875,8 @@ out: int glusterd_mgmt_v3_commit (glusterd_conf_t *conf, glusterd_op_t op, - dict_t *req_dict, char **op_errstr, int npeers) + dict_t *op_ctx, dict_t *req_dict, + char **op_errstr, int npeers) { int ret = -1; int peer_cnt = 0; @@ -889,6 +919,15 @@ glusterd_mgmt_v3_commit (glusterd_conf_t *conf, glusterd_op_t op, goto out; } + ret = glusterd_syncop_aggr_rsp_dict (op, op_ctx, + rsp_dict); + if (ret) { + gf_log ("", GF_LOG_ERROR, "%s", + "Failed to aggregate response from " + " node/brick"); + goto out; + } + dict_unref (rsp_dict); rsp_dict = NULL; @@ -898,6 +937,7 @@ glusterd_mgmt_v3_commit (glusterd_conf_t *conf, glusterd_op_t op, } /* Sending commit req to other nodes in the cluster */ + gd_syncargs_init (&args, op_ctx); synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { @@ -1064,6 +1104,7 @@ glusterd_mgmt_v3_post_validate (glusterd_conf_t *conf, glusterd_op_t op, } /* Sending Post Validation req to other nodes in the cluster */ + gd_syncargs_init (&args, NULL); synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { @@ -1203,6 +1244,7 @@ glusterd_mgmt_v3_release_peer_locks (glusterd_conf_t *conf, glusterd_op_t op, } /* Sending Volume unlock req to other nodes in the cluster */ + gd_syncargs_init (&args, NULL); synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { @@ -1317,7 +1359,7 @@ glusterd_mgmt_v3_initiate_all_phases (rpcsvc_request_t *req, glusterd_op_t op, } /* COMMIT OP PHASE */ - ret = glusterd_mgmt_v3_commit (conf, op, req_dict, + ret = glusterd_mgmt_v3_commit (conf, op, dict, req_dict, &op_errstr, npeers); if (ret) { gf_log ("", GF_LOG_ERROR, "Commit Op Failed"); @@ -1467,7 +1509,7 @@ glusterd_mgmt_v3_initiate_snap_phases (rpcsvc_request_t *req, glusterd_op_t op, } /* COMMIT OP PHASE */ - ret = glusterd_mgmt_v3_commit (conf, op, req_dict, + ret = glusterd_mgmt_v3_commit (conf, op, dict, req_dict, &op_errstr, npeers); if (ret) { gf_log ("", GF_LOG_ERROR, "Commit Op Failed"); |