summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-syncop.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
index c975d01f1b2..4319841c5b3 100644
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
@@ -1067,6 +1067,8 @@ gd_unlock_op_phase (struct list_head *peers, glusterd_op_t op, int op_ret,
xlator_t *this = NULL;
struct syncargs args = {0};
+ this = THIS;
+
if (!npeers) {
ret = 0;
goto out;
@@ -1077,7 +1079,6 @@ gd_unlock_op_phase (struct list_head *peers, glusterd_op_t op, int op_ret,
if (!is_locked)
goto out;
- this = THIS;
synctask_barrier_init((&args));
peer_cnt = 0;
list_for_each_entry_safe (peerinfo, tmp, peers, op_peers_list) {
@@ -1099,9 +1100,11 @@ gd_unlock_op_phase (struct list_head *peers, glusterd_op_t op, int op_ret,
out:
glusterd_op_send_cli_response (op, op_ret, 0, req, op_ctx, op_errstr);
- glusterd_op_clear_op (op);
- if (is_locked)
+ /* Unlock and reset opinfo.op ONLY if lock ever succeeded! */
+ if (is_locked) {
+ glusterd_op_clear_op (op);
glusterd_unlock (MY_UUID);
+ }
return 0;
}