diff options
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-mgmt.c | 106 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 113 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.h | 17 |
3 files changed, 125 insertions, 111 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-mgmt.c index 52b4184ee7a..f26c676cd67 100644 --- a/xlators/mgmt/glusterd/src/glusterd-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-mgmt.c @@ -276,14 +276,14 @@ int32_t gd_mgmt_v3_lock_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int32_t ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_lock_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int32_t op_ret = -1; - int32_t op_errno = -1; - xlator_t *this = NULL; + int32_t ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_lock_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int32_t op_ret = -1; + int32_t op_errno = -1; + xlator_t *this = NULL; this = THIS; GF_ASSERT (this); @@ -370,6 +370,7 @@ gd_mgmt_v3_lock (glusterd_op_t op, dict_t *op_ctx, uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); + ret = gd_syncop_submit_request (peerinfo->rpc, &req, args, peerinfo, &gd_mgmt_v3_prog, GLUSTERD_MGMT_V3_LOCK, @@ -500,15 +501,15 @@ int32_t gd_mgmt_v3_pre_validate_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int32_t ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_pre_val_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int32_t op_ret = -1; - int32_t op_errno = -1; - dict_t *rsp_dict = NULL; - xlator_t *this = NULL; + int32_t ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_pre_val_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int32_t op_ret = -1; + int32_t op_errno = -1; + dict_t *rsp_dict = NULL; + xlator_t *this = NULL; this = THIS; GF_ASSERT (this); @@ -624,6 +625,7 @@ gd_mgmt_v3_pre_validate_req (glusterd_op_t op, dict_t *op_ctx, uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); + ret = gd_syncop_submit_request (peerinfo->rpc, &req, args, peerinfo, &gd_mgmt_v3_prog, GLUSTERD_MGMT_V3_PRE_VALIDATE, @@ -767,14 +769,14 @@ int32_t gd_mgmt_v3_brick_op_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int32_t ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_brick_op_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int32_t op_ret = -1; - int32_t op_errno = -1; - xlator_t *this = NULL; + int32_t ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_brick_op_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int32_t op_ret = -1; + int32_t op_errno = -1; + xlator_t *this = NULL; this = THIS; GF_ASSERT (this); @@ -862,6 +864,7 @@ gd_mgmt_v3_brick_op_req (glusterd_op_t op, dict_t *op_ctx, uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); + ret = gd_syncop_submit_request (peerinfo->rpc, &req, args, peerinfo, &gd_mgmt_v3_prog, GLUSTERD_MGMT_V3_BRICK_OP, @@ -964,15 +967,15 @@ int32_t gd_mgmt_v3_commit_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int32_t ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_commit_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int32_t op_ret = -1; - int32_t op_errno = -1; - dict_t *rsp_dict = NULL; - xlator_t *this = NULL; + int32_t ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_commit_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int32_t op_ret = -1; + int32_t op_errno = -1; + dict_t *rsp_dict = NULL; + xlator_t *this = NULL; this = THIS; GF_ASSERT (this); @@ -1086,6 +1089,7 @@ gd_mgmt_v3_commit_req (glusterd_op_t op, dict_t *op_ctx, uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); + ret = gd_syncop_submit_request (peerinfo->rpc, &req, args, peerinfo, &gd_mgmt_v3_prog, GLUSTERD_MGMT_V3_COMMIT, @@ -1199,14 +1203,14 @@ int32_t gd_mgmt_v3_post_validate_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int32_t ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_post_val_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int32_t op_ret = -1; - int32_t op_errno = -1; - xlator_t *this = NULL; + int32_t ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_post_val_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int32_t op_ret = -1; + int32_t op_errno = -1; + xlator_t *this = NULL; this = THIS; GF_ASSERT (this); @@ -1289,6 +1293,7 @@ gd_mgmt_v3_post_validate_req (glusterd_op_t op, int32_t op_ret, dict_t *op_ctx, req.op = op; req.op_ret = op_ret; synclock_unlock (&conf->big_lock); + ret = gd_syncop_submit_request (peerinfo->rpc, &req, args, peerinfo, &gd_mgmt_v3_prog, GLUSTERD_MGMT_V3_POST_VALIDATE, @@ -1397,14 +1402,14 @@ int32_t gd_mgmt_v3_unlock_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int32_t ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_unlock_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int32_t op_ret = -1; - int32_t op_errno = -1; - xlator_t *this = NULL; + int32_t ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_unlock_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int32_t op_ret = -1; + int32_t op_errno = -1; + xlator_t *this = NULL; this = THIS; GF_ASSERT (this); @@ -1483,6 +1488,7 @@ gd_mgmt_v3_unlock (glusterd_op_t op, dict_t *op_ctx, uuid_copy (req.uuid, my_uuid); req.op = op; synclock_unlock (&conf->big_lock); + ret = gd_syncop_submit_request (peerinfo->rpc, &req, args, peerinfo, &gd_mgmt_v3_prog, GLUSTERD_MGMT_V3_UNLOCK, diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 8110579de1f..534e3032105 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -316,13 +316,13 @@ int32_t gd_syncop_mgmt_v3_lock_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_lock_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int op_ret = -1; - int op_errno = -1; + int ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_lock_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int op_ret = -1; + int op_errno = -1; GF_ASSERT(req); GF_ASSERT(iov); @@ -405,13 +405,13 @@ int32_t gd_syncop_mgmt_v3_unlock_cbk_fn (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_v3_unlock_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int op_ret = -1; - int op_errno = -1; + int ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_v3_unlock_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int op_ret = -1; + int op_errno = -1; GF_ASSERT(req); GF_ASSERT(iov); @@ -495,13 +495,13 @@ int32_t _gd_syncop_mgmt_lock_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_cluster_lock_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int op_ret = -1; - int op_errno = -1; + int ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_cluster_lock_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int op_ret = -1; + int op_errno = -1; frame = myframe; args = frame->local; @@ -565,13 +565,13 @@ int32_t _gd_syncop_mgmt_unlock_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int ret = -1; - struct syncargs *args = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - gd1_mgmt_cluster_unlock_rsp rsp = {{0},}; - call_frame_t *frame = NULL; - int op_ret = -1; - int op_errno = -1; + int ret = -1; + struct syncargs *args = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + gd1_mgmt_cluster_unlock_rsp rsp = {{0},}; + call_frame_t *frame = NULL; + int op_ret = -1; + int op_errno = -1; frame = myframe; args = frame->local; @@ -633,19 +633,20 @@ int32_t _gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int ret = -1; - gd1_mgmt_stage_op_rsp rsp = {{0},}; - struct syncargs *args = NULL; - xlator_t *this = NULL; - dict_t *rsp_dict = NULL; - call_frame_t *frame = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - int op_ret = -1; - int op_errno = -1; + int ret = -1; + gd1_mgmt_stage_op_rsp rsp = {{0},}; + struct syncargs *args = NULL; + xlator_t *this = NULL; + dict_t *rsp_dict = NULL; + call_frame_t *frame = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + int op_ret = -1; + int op_errno = -1; this = THIS; frame = myframe; args = frame->local; + peerinfo = frame->cookie; frame->local = NULL; if (-1 == req->rpc_status) { @@ -724,7 +725,7 @@ gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov, int -gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, struct syncargs *args, +gd_syncop_mgmt_stage_op (glusterd_peerinfo_t *peerinfo, struct syncargs *args, uuid_t my_uuid, uuid_t recv_uuid, int op, dict_t *dict_out, dict_t *op_ctx) { @@ -745,8 +746,8 @@ gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, struct syncargs *args, goto out; synclock_unlock (&conf->big_lock); - ret = gd_syncop_submit_request (rpc, req, args, NULL, &gd_mgmt_prog, - GLUSTERD_MGMT_STAGE_OP, + ret = gd_syncop_submit_request (peerinfo->rpc, req, args, peerinfo, + &gd_mgmt_prog, GLUSTERD_MGMT_STAGE_OP, gd_syncop_stage_op_cbk, (xdrproc_t) xdr_gd1_mgmt_stage_op_req); synclock_lock (&conf->big_lock); @@ -888,20 +889,21 @@ int32_t _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { - int ret = -1; - gd1_mgmt_commit_op_rsp rsp = {{0},}; - struct syncargs *args = NULL; - xlator_t *this = NULL; - dict_t *rsp_dict = NULL; - call_frame_t *frame = NULL; - glusterd_peerinfo_t *peerinfo = NULL; - int op_ret = -1; - int op_errno = -1; - int type = GF_QUOTA_OPTION_TYPE_NONE; + int ret = -1; + gd1_mgmt_commit_op_rsp rsp = {{0},}; + struct syncargs *args = NULL; + xlator_t *this = NULL; + dict_t *rsp_dict = NULL; + call_frame_t *frame = NULL; + glusterd_peerinfo_t *peerinfo = NULL; + int op_ret = -1; + int op_errno = -1; + int type = GF_QUOTA_OPTION_TYPE_NONE; this = THIS; frame = myframe; args = frame->local; + peerinfo = frame->cookie; frame->local = NULL; if (-1 == req->rpc_status) { @@ -931,6 +933,7 @@ _gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov, } peerinfo = glusterd_peerinfo_find (rsp.uuid, NULL); + if (peerinfo == NULL) { ret = -1; gf_log (this->name, GF_LOG_CRITICAL, "Commit response " @@ -988,7 +991,7 @@ gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov, int -gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, struct syncargs *args, +gd_syncop_mgmt_commit_op (glusterd_peerinfo_t *peerinfo, struct syncargs *args, uuid_t my_uuid, uuid_t recv_uuid, int op, dict_t *dict_out, dict_t *op_ctx) { @@ -1009,8 +1012,8 @@ gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, struct syncargs *args, goto out; synclock_unlock (&conf->big_lock); - ret = gd_syncop_submit_request (rpc, req, args, NULL, &gd_mgmt_prog, - GLUSTERD_MGMT_COMMIT_OP , + ret = gd_syncop_submit_request (peerinfo->rpc, req, args, peerinfo, + &gd_mgmt_prog, GLUSTERD_MGMT_COMMIT_OP, gd_syncop_commit_op_cbk, (xdrproc_t) xdr_gd1_mgmt_commit_op_req); synclock_lock (&conf->big_lock); @@ -1163,7 +1166,7 @@ stage_done: synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { - ret = gd_syncop_mgmt_stage_op (peerinfo->rpc, &args, + ret = gd_syncop_mgmt_stage_op (peerinfo, &args, MY_UUID, tmp_uuid, op, req_dict, op_ctx); peer_cnt++; @@ -1267,7 +1270,7 @@ commit_done: synctask_barrier_init((&args)); peer_cnt = 0; list_for_each_entry (peerinfo, peers, op_peers_list) { - ret = gd_syncop_mgmt_commit_op (peerinfo->rpc, &args, + ret = gd_syncop_mgmt_commit_op (peerinfo, &args, MY_UUID, tmp_uuid, op, req_dict, op_ctx); peer_cnt++; diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.h b/xlators/mgmt/glusterd/src/glusterd-syncop.h index e83ea2f4c46..c7924b5a025 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.h +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.h @@ -44,14 +44,19 @@ int gd_syncop_submit_request (struct rpc_clnt *rpc, void *req, void *local, int gd_syncop_mgmt_lock (glusterd_peerinfo_t *peerinfo, struct syncargs *arg, uuid_t my_uuid, uuid_t recv_uuid); + int gd_syncop_mgmt_unlock (glusterd_peerinfo_t *peerinfo, struct syncargs *arg, uuid_t my_uuid, uuid_t recv_uuid); -int gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, struct syncargs *arg, - uuid_t my_uuid, uuid_t recv_uuid, int op, - dict_t *dict_out, dict_t *op_ctx); -int gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, struct syncargs *arg, - uuid_t my_uuid, uuid_t recv_uuid, int op, - dict_t *dict_out, dict_t *op_ctx); + +int gd_syncop_mgmt_stage_op (glusterd_peerinfo_t *peerinfo, + struct syncargs *arg, uuid_t my_uuid, + uuid_t recv_uuid, int op, dict_t *dict_out, + dict_t *op_ctx); + +int gd_syncop_mgmt_commit_op (glusterd_peerinfo_t *peerinfo, + struct syncargs *arg, uuid_t my_uuid, + uuid_t recv_uuid, int op, dict_t *dict_out, + dict_t *op_ctx); void gd_synctask_barrier_wait (struct syncargs *args, int count); |