diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2013-12-09 16:46:06 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2013-12-16 21:37:30 -0800 |
commit | 9031a90613c1cadcab32c418e0e2cc5b14afbba1 (patch) | |
tree | 49bad662c0e18b09ca42a35575e0d27e392202e6 | |
parent | 588185463d1bbf1b011e3b0471771b3d4f4aa145 (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/6463
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: venkatesh somyajulu <vsomyaju@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 35 | ||||
-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, 22 insertions, 18 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index af01f2ef2..a4f97e950 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -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; @@ -2420,16 +2421,15 @@ 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); @@ -2500,10 +2500,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 8dbb9c69e..dfa91d785 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 dcf0f8d0c..dc0bc06fb 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" |