summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-syncop.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-syncop.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index 4430b41a8b8..5730dc48a41 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -18,6 +18,16 @@
#include "glusterd-op-sm.h"
#include "glusterd-utils.h"
+static inline void
+gd_synctask_barrier_wait (struct syncargs *args, int count)
+{
+ glusterd_conf_t *conf = THIS->private;
+
+ synclock_unlock (&conf->big_lock);
+ synctask_barrier_wait (args, count);
+ synclock_lock (&conf->big_lock);
+}
+
static void
gd_collate_errors (struct syncargs *args, int op_ret, int op_errno,
char *op_errstr)
@@ -663,7 +673,7 @@ gd_lock_op_phase (struct list_head *peers, glusterd_op_t op, dict_t *op_ctx,
gd_syncop_mgmt_lock (peerinfo->rpc, &args, MY_UUID, peer_uuid);
peer_cnt++;
}
- synctask_barrier_wait((&args), peer_cnt);
+ gd_synctask_barrier_wait((&args), peer_cnt);
ret = args.op_ret;
if (ret) {
gf_asprintf (op_errstr, "Another transaction could be "
@@ -741,7 +751,7 @@ stage_done:
op, req_dict, op_ctx);
peer_cnt++;
}
- synctask_barrier_wait((&args), peer_cnt);
+ gd_synctask_barrier_wait((&args), peer_cnt);
ret = args.op_ret;
if (dict_get_str (op_ctx, "errstr", &errstr) == 0)
*op_errstr = gf_strdup (errstr);
@@ -816,7 +826,7 @@ commit_done:
op, req_dict, op_ctx);
peer_cnt++;
}
- synctask_barrier_wait((&args), peer_cnt);
+ gd_synctask_barrier_wait((&args), peer_cnt);
ret = args.op_ret;
if (dict_get_str (op_ctx, "errstr", &errstr) == 0)
*op_errstr = gf_strdup (errstr);
@@ -853,7 +863,7 @@ gd_unlock_op_phase (struct list_head *peers, glusterd_op_t op, int op_ret,
list_del_init (&peerinfo->op_peers_list);
peer_cnt++;
}
- synctask_barrier_wait((&args), peer_cnt);
+ gd_synctask_barrier_wait((&args), peer_cnt);
ret = args.op_ret;
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Failed to unlock "
@@ -889,8 +899,10 @@ gd_brick_op_phase (glusterd_op_t op, dict_t *op_ctx, dict_t *req_dict, char **op
int ret = -1;
rpc_clnt_t *rpc = NULL;
dict_t *rsp_dict = NULL;
+ glusterd_conf_t *conf = NULL;
this = THIS;
+ conf = this->private;
rsp_dict = dict_new ();
if (!rsp_dict) {
ret = -1;
@@ -930,8 +942,12 @@ 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;