summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heald.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-04-03 08:12:34 +0530
committerVijay Bellur <vijay@gluster.com>2012-04-05 05:07:19 -0700
commit7d62749f14663ea6c0000a4aab2c32041cbb4e75 (patch)
treea7b8228ece64b1e842a4f29b56a23b80d8173019 /xlators/cluster/afr/src/afr-self-heald.c
parent1f3a0dd4742a2fcd3215aee4a5e22125d7ea4f4d (diff)
self-heald: Find self-heal failures, split-brain
Change-Id: Ib967f0fe0b537fe60e51d7d05462b58a7f16596e BUG: 806745 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3077 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heald.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 3068d5c46d0..55ede78ad63 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -277,7 +277,7 @@ out:
void
_crawl_post_sh_action (xlator_t *this, loc_t *parent, loc_t *child,
- int32_t op_ret, int32_t op_errno,
+ int32_t op_ret, int32_t op_errno, dict_t *xattr_rsp,
afr_crawl_data_t *crawl_data)
{
int ret = 0;
@@ -286,6 +286,8 @@ _crawl_post_sh_action (xlator_t *this, loc_t *parent, loc_t *child,
eh_t *eh = NULL;
char *path = NULL;
shd_event_t *event = NULL;
+ int32_t sh_failed = 0;
+ gf_boolean_t split_brain = 0;
priv = this->private;
shd = &priv->shd;
@@ -307,9 +309,12 @@ _crawl_post_sh_action (xlator_t *this, loc_t *parent, loc_t *child,
}
}
- if (op_ret < 0 && op_errno == EIO)
+ if (xattr_rsp)
+ ret = dict_get_int32 (xattr_rsp, "sh-failed", &sh_failed);
+ split_brain = afr_is_split_brain (this, child->inode);
+ if ((op_ret < 0 && op_errno == EIO) || split_brain)
eh = shd->split_brain;
- else if (op_ret < 0)
+ else if ((op_ret < 0) || sh_failed)
eh = shd->heal_failed;
else
eh = shd->healed;
@@ -338,6 +343,7 @@ _self_heal_entry (xlator_t *this, afr_crawl_data_t *crawl_data, gf_dirent_t *ent
{
struct iatt parentbuf = {0};
int ret = 0;
+ dict_t *xattr_rsp = NULL;
if (uuid_is_null (child->gfid))
gf_log (this->name, GF_LOG_DEBUG, "lookup %s", child->path);
@@ -346,8 +352,11 @@ _self_heal_entry (xlator_t *this, afr_crawl_data_t *crawl_data, gf_dirent_t *ent
uuid_utoa (child->gfid));
ret = syncop_lookup (this, child, NULL,
- iattr, NULL, &parentbuf);
- _crawl_post_sh_action (this, parent, child, ret, errno, crawl_data);
+ iattr, &xattr_rsp, &parentbuf);
+ _crawl_post_sh_action (this, parent, child, ret, errno, xattr_rsp,
+ crawl_data);
+ if (xattr_rsp)
+ dict_unref (xattr_rsp);
return ret;
}