summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2019-04-01 11:53:57 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2019-04-02 12:18:33 +0000
commit0a827c1da96302661202e46ea43b6e2526a7ac87 (patch)
treefafae8844d92831c7b5c691bc0b22b8667f876a4 /xlators/cluster/afr/src/afr-common.c
parentd0d3e10d44366c68fc153e48b229e72a4aa26e61 (diff)
cluster/afr: Send inodelk/entrylk with non-zero lk-owner
Found missing assignment of lk-owner for an inodelk/entrylk before winding the fops. locks xlator at the moment allows this operation. This leads to multiple threads in the same client being able to get locks on the inode because lk-owner is same and transport is same. So isolation with locks can't be achieved. To fix it, we need locks xlator change which will disallow null-lk-owner based inodelk/entrylk/lk. To achieve that we need to first fix all the places which do this mistake. updates bz#1624701 Change-Id: Ic3431da3f451a1414f1f4fdcfc4cf41e555f69dd Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 002f972..8c8cc0c 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -6463,6 +6463,8 @@ afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc)
int op_errno = 0;
dict_t *dict = NULL;
afr_local_t *local = NULL;
+ afr_local_t *heal_local = NULL;
+ call_frame_t *heal_frame = NULL;
local = frame->local;
dict = dict_new();
@@ -6472,7 +6474,16 @@ afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc)
goto out;
}
- ret = afr_selfheal_do(frame, this, loc->gfid);
+ heal_frame = afr_frame_create(this, &op_errno);
+ if (!heal_frame) {
+ ret = -1;
+ goto out;
+ }
+ heal_local = heal_frame->local;
+ heal_frame->local = frame->local;
+ /*Initiate heal with heal_frame with lk-owner set so that inodelk/entrylk
+ * work correctly*/
+ ret = afr_selfheal_do(heal_frame, this, loc->gfid);
if (ret == 1 || ret == 2) {
ret = dict_set_sizen_str_sizen(dict, "sh-fail-msg",
@@ -6494,6 +6505,10 @@ afr_heal_splitbrain_file(call_frame_t *frame, xlator_t *this, loc_t *loc)
}
out:
+ if (heal_frame) {
+ heal_frame->local = heal_local;
+ AFR_STACK_DESTROY(heal_frame);
+ }
if (local->op == GF_FOP_GETXATTR)
AFR_STACK_UNWIND(getxattr, frame, ret, op_errno, dict, NULL);
else if (local->op == GF_FOP_SETXATTR)