diff options
author | Krishnan Parthasarathi <kparthas@redhat.com> | 2013-05-02 16:13:59 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-05-02 18:16:33 -0700 |
commit | b224d7ffb88c274ef0a65d4b5d30b2ce320c6200 (patch) | |
tree | e9f5fc376571bf59a0885b3e0ce50394790be51a /xlators/mgmt/glusterd/src | |
parent | 6556b5cf4077dc45a4c59d2d9ee2f23f5d0a80b0 (diff) |
glusterd: Syncop callbks should take big lock too
Change-Id: I5ae71ab98f9a336dc9bbf0e7b2ec50a6ed42b0f5
BUG: 948686
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/4938
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 61 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.h | 5 |
2 files changed, 53 insertions, 13 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 51a89cda865..f39694b79c1 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -209,8 +209,8 @@ out: } int32_t -gd_syncop_mgmt_lock_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe) +_gd_syncop_mgmt_lock_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) { int ret = -1; struct syncargs *args = NULL; @@ -240,6 +240,13 @@ out: return 0; } +int32_t +gd_syncop_mgmt_lock_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) +{ + return glusterd_big_locked_cbk (req, iov, count, myframe, + _gd_syncop_mgmt_lock_cbk); +} int gd_syncop_mgmt_lock (struct rpc_clnt *rpc, struct syncargs *args, @@ -261,8 +268,8 @@ gd_syncop_mgmt_lock (struct rpc_clnt *rpc, struct syncargs *args, } int32_t -gd_syncop_mgmt_unlock_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe) +_gd_syncop_mgmt_unlock_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) { int ret = -1; struct syncargs *args = NULL; @@ -292,6 +299,14 @@ out: return 0; } +int32_t +gd_syncop_mgmt_unlock_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) +{ + return glusterd_big_locked_cbk (req, iov, count, myframe, + _gd_syncop_mgmt_unlock_cbk); +} + int gd_syncop_mgmt_unlock (struct rpc_clnt *rpc, struct syncargs *args, @@ -313,8 +328,8 @@ gd_syncop_mgmt_unlock (struct rpc_clnt *rpc, struct syncargs *args, } int32_t -gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe) +_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},}; @@ -378,6 +393,14 @@ out: return 0; } +int32_t +gd_syncop_stage_op_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) +{ + return glusterd_big_locked_cbk (req, iov, count, myframe, + _gd_syncop_stage_op_cbk); +} + int gd_syncop_mgmt_stage_op (struct rpc_clnt *rpc, struct syncargs *args, @@ -415,7 +438,7 @@ out: } int32_t -gd_syncop_brick_op_cbk (struct rpc_req *req, struct iovec *iov, +_gd_syncop_brick_op_cbk (struct rpc_req *req, struct iovec *iov, int count, void *myframe) { struct syncargs *args = NULL; @@ -471,6 +494,14 @@ out: return 0; } +int32_t +gd_syncop_brick_op_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) +{ + return glusterd_big_locked_cbk (req, iov, count, myframe, + _gd_syncop_brick_op_cbk); +} + int gd_syncop_mgmt_brick_op (struct rpc_clnt *rpc, glusterd_pending_node_t *pnode, int op, dict_t *dict_out, dict_t *op_ctx, @@ -534,8 +565,8 @@ out: } int32_t -gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov, - int count, void *myframe) +_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},}; @@ -597,6 +628,14 @@ out: return 0; } +int32_t +gd_syncop_commit_op_cbk (struct rpc_req *req, struct iovec *iov, + int count, void *myframe) +{ + return glusterd_big_locked_cbk (req, iov, count, myframe, + _gd_syncop_commit_op_cbk); +} + int gd_syncop_mgmt_commit_op (struct rpc_clnt *rpc, struct syncargs *args, @@ -942,12 +981,8 @@ gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, char **op "due to rpc failure."); goto out; } - /*This is to ensure that the brick_op_cbk is able to take - * the big lock*/ - synclock_unlock (&conf->big_lock); ret = gd_syncop_mgmt_brick_op (rpc, pending_node, op, req_dict, op_ctx, op_errstr); - synclock_lock (&conf->big_lock); if (ret) goto out; diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.h b/xlators/mgmt/glusterd/src/glusterd-syncop.h index 212e495d52d..3e3980c442f 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.h +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.h @@ -18,16 +18,21 @@ #define GD_SYNCOP(rpc, stb, cbk, req, prog, procnum, xdrproc) do { \ int ret = 0; \ struct synctask *task = NULL; \ + glusterd_conf_t *conf= THIS->private; \ gf_boolean_t cbk_lost = _gf_true; \ task = synctask_get (); \ stb->task = task; \ \ + /*This is to ensure that the brick_op_cbk is able to \ + * take the big lock*/ \ + synclock_unlock (&conf->big_lock); \ ret = gd_syncop_submit_request (rpc, req, stb, \ prog, procnum, cbk, \ (xdrproc_t)xdrproc, \ &cbk_lost); \ if (!cbk_lost) \ synctask_yield (stb->task); \ + synclock_lock (&conf->big_lock); \ } while (0) |