diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-12-09 16:46:06 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-04-28 09:35:49 -0700 |
commit | ba8212527e886a94b8d393172e0672c44de8457b (patch) | |
tree | 554bb8af7c8e71de06289b58b00a4c743e0b3e01 /xlators/cluster | |
parent | f2d39b9aa90dd06b37ee9e86e00420395efabd0f (diff) |
cluster/afr: Add foreground self-heal launch capability through lookup.
Also renamed allow-sh-for-running-transaction -> attempt-self-heal.
Change-Id: I134cc79e663b532e625ffc342c59e49e71644ab3
BUG: 1039544
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/6509
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 38 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.h | 3 |
3 files changed, 24 insertions, 19 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index acb6bc0e86a..66978a910aa 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1824,7 +1824,7 @@ afr_lookup_perform_self_heal (call_frame_t *frame, xlator_t *this, local = frame->local; up_count = afr_up_children_count (local->child_up, priv->child_count); - if (up_count == 1) { + if (!local->attempt_self_heal && up_count == 1) { gf_log (this->name, GF_LOG_DEBUG, "Only 1 child up - do not attempt to detect self heal"); goto out; @@ -1833,12 +1833,13 @@ afr_lookup_perform_self_heal (call_frame_t *frame, xlator_t *this, afr_lookup_set_self_heal_params (local, this); if (afr_can_self_heal_proceed (&local->self_heal, priv)) { if (afr_is_transaction_running (local) && - (!local->allow_sh_for_running_transaction)) + (!local->attempt_self_heal)) goto out; reason = "lookup detected pending operations"; afr_launch_self_heal (frame, this, local->cont.lookup.inode, - _gf_true, local->cont.lookup.buf.ia_type, + !local->foreground_self_heal, + local->cont.lookup.buf.ia_type, reason, afr_post_gfid_sh_success, afr_self_heal_lookup_unwind); *sh_launched = _gf_true; @@ -2422,16 +2423,16 @@ int afr_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xattr_req) { - afr_private_t *priv = NULL; - afr_local_t *local = NULL; - void *gfid_req = NULL; - int ret = -1; - int i = 0; - int call_count = 0; - uint64_t ctx = 0; - int32_t op_errno = 0; - int allow_sh = 0; - priv = this->private; + afr_private_t *priv = NULL; + afr_local_t *local = NULL; + void *gfid_req = NULL; + int ret = -1; + int i = 0; + int call_count = 0; + uint64_t ctx = 0; + int32_t op_errno = 0; + + priv = this->private; AFR_LOCAL_ALLOC_OR_GOTO (local, out); @@ -2502,10 +2503,13 @@ afr_lookup (call_frame_t *frame, xlator_t *this, /* By default assume ENOTCONN. On success it will be set to 0. */ local->op_errno = ENOTCONN; - ret = dict_get_int32 (xattr_req, "allow-sh-for-running-transaction", - &allow_sh); - dict_del (xattr_req, "allow-sh-for-running-transaction"); - local->allow_sh_for_running_transaction = allow_sh; + ret = dict_get_int32 (xattr_req, "attempt-self-heal", + &local->attempt_self_heal); + dict_del (xattr_req, "attempt-self-heal"); + + ret = dict_get_int32 (xattr_req, "foreground-self-heal", + &local->foreground_self_heal); + dict_del (xattr_req, "foreground-self-heal"); ret = afr_lookup_xattr_req_prepare (local, this, xattr_req, &local->loc, &gfid_req); diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 8dbb9c69e71..dfa91d78501 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -641,7 +641,7 @@ _self_heal_entry (xlator_t *this, afr_crawl_data_t *crawl_data, gf_dirent_t *ent goto out; } - ret = dict_set_int32 (xattr_req, "allow-sh-for-running-transaction", 1); + ret = dict_set_int32 (xattr_req, "attempt-self-heal", 1); gf_log (this->name, GF_LOG_DEBUG, "lookup %s", child->path); diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index dcf0f8d0cf1..dc0bc06fb70 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -509,7 +509,8 @@ typedef struct _afr_local { */ gf_boolean_t append_write; - int allow_sh_for_running_transaction; + int attempt_self_heal; + int foreground_self_heal; /* This struct contains the arguments for the "continuation" |