From d9bfccc8425befa5d13058b5f5352598a2085161 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 17 Apr 2019 13:58:21 +0530 Subject: cluster/afr: Set lk-owner before inodelk/entrylk/lk Updates: bz#1624701 Change-Id: I7152c28ad85925abccdcc4cd6de8cb2a2b847a51 Signed-off-by: Pranith Kumar K --- xlators/cluster/afr/src/afr-common.c | 37 +++++++++++++------------- xlators/cluster/afr/src/afr-self-heal-common.c | 5 +++- 2 files changed, 23 insertions(+), 19 deletions(-) (limited to 'xlators/cluster/afr/src') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index d671b564f47..fbd5dd9b1d3 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1172,7 +1172,6 @@ afr_txn_refresh_done(call_frame_t *frame, xlator_t *this, int err) inode_t *inode = NULL; int event_generation = 0; int read_subvol = -1; - int op_errno = ENOMEM; int ret = 0; local = frame->local; @@ -1201,18 +1200,12 @@ afr_txn_refresh_done(call_frame_t *frame, xlator_t *this, int err) goto refresh_done; } - heal_frame = copy_frame(frame); + heal_frame = afr_frame_create(this, NULL); if (!heal_frame) { err = EIO; goto refresh_done; } - heal_frame->root->pid = GF_CLIENT_PID_SELF_HEALD; - heal_local = AFR_FRAME_INIT(heal_frame, op_errno); - if (!heal_local) { - err = EIO; - AFR_STACK_DESTROY(heal_frame); - goto refresh_done; - } + heal_local = heal_frame->local; heal_local->xdata_req = dict_new(); if (!heal_local->xdata_req) { err = EIO; @@ -1254,7 +1247,6 @@ afr_inode_refresh_done(call_frame_t *frame, xlator_t *this, int error) gf_boolean_t start_heal = _gf_false; afr_local_t *heal_local = NULL; unsigned char *success_replies = NULL; - int op_errno = ENOMEM; int ret = 0; if (error != 0) { @@ -1288,15 +1280,10 @@ afr_inode_refresh_done(call_frame_t *frame, xlator_t *this, int error) ret = afr_replies_interpret(frame, this, local->refreshinode, &start_heal); if (ret && afr_selfheal_enabled(this) && start_heal) { - heal_frame = copy_frame(frame); + heal_frame = afr_frame_create(this, NULL); if (!heal_frame) goto refresh_done; - heal_frame->root->pid = GF_CLIENT_PID_SELF_HEALD; - heal_local = AFR_FRAME_INIT(heal_frame, op_errno); - if (!heal_local) { - AFR_STACK_DESTROY(heal_frame); - goto refresh_done; - } + heal_local = heal_frame->local; heal_local->refreshinode = inode_ref(local->refreshinode); heal_local->heal_frame = heal_frame; if (!afr_throttled_selfheal(heal_frame, this)) { @@ -6176,8 +6163,18 @@ afr_get_heal_info(call_frame_t *frame, xlator_t *this, loc_t *loc) inode_t *inode = NULL; char *substr = NULL; char *status = NULL; + call_frame_t *heal_frame = NULL; + afr_local_t *heal_local = NULL; - ret = afr_selfheal_locked_inspect(frame, this, loc->gfid, &inode, + /*Use frame with lk-owner set*/ + heal_frame = afr_frame_create(frame->this, &op_errno); + if (!heal_frame) { + ret = -1; + goto out; + } + heal_local = heal_frame->local; + heal_frame->local = frame->local; + ret = afr_selfheal_locked_inspect(heal_frame, this, loc->gfid, &inode, &entry_selfheal, &data_selfheal, &metadata_selfheal, &pending); @@ -6264,6 +6261,10 @@ afr_get_heal_info(call_frame_t *frame, xlator_t *this, loc_t *loc) op_errno = 0; out: + if (heal_frame) { + heal_frame->local = heal_local; + AFR_STACK_DESTROY(heal_frame); + } AFR_STACK_UNWIND(getxattr, frame, ret, op_errno, dict, NULL); if (dict) dict_unref(dict); diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 595bed4d2dd..81fd8d65076 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -2413,8 +2413,11 @@ afr_frame_create(xlator_t *this, int32_t *op_errno) pid_t pid = GF_CLIENT_PID_SELF_HEALD; frame = create_frame(this, this->ctx->pool); - if (!frame) + if (!frame) { + if (op_errno) + *op_errno = ENOMEM; return NULL; + } local = AFR_FRAME_INIT(frame, (*op_errno)); if (!local) { -- cgit