From b224d7ffb88c274ef0a65d4b5d30b2ce320c6200 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Thu, 2 May 2013 16:13:59 +0530 Subject: glusterd: Syncop callbks should take big lock too Change-Id: I5ae71ab98f9a336dc9bbf0e7b2ec50a6ed42b0f5 BUG: 948686 Signed-off-by: Krishnan Parthasarathi Reviewed-on: http://review.gluster.org/4938 Reviewed-by: Amar Tumballi Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/mgmt/glusterd/src/glusterd-syncop.c | 61 +++++++++++++++++++++++------ xlators/mgmt/glusterd/src/glusterd-syncop.h | 5 +++ 2 files changed, 53 insertions(+), 13 deletions(-) (limited to 'xlators/mgmt') diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index 51a89cda8..f39694b79 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 212e495d5..3e3980c44 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) -- cgit