From 7d62749f14663ea6c0000a4aab2c32041cbb4e75 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 3 Apr 2012 08:12:34 +0530 Subject: self-heald: Find self-heal failures, split-brain Change-Id: Ib967f0fe0b537fe60e51d7d05462b58a7f16596e BUG: 806745 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/3077 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-self-heald.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heald.c') 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; } -- cgit