summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Wareing <rwareing@fb.com>2016-03-25 15:21:23 -0700
committerShreyas Siravara <sshreyas@fb.com>2017-09-03 03:20:08 +0000
commit03f1742d2b45ab000c1d79619fc5ef2c2f4cd53e (patch)
treece2849a9b63f4dc1ab77298569150ee31870b06d
parentf3100ee0399889d6c4bc4b56368f91c1b8875470 (diff)
cluster/afr: PGFID heal only when all children are up
Summary: - PGFID healing is pointless when a child is down, since the heal will fail for that reason (and we have no signal for this). Instead restrict PGFID healing to the case where all children are up. - This is a port of D3100450 to 3.8 Test Plan: Run prove -v tests/basic/afr/shd-pgfid-heal.t Reviewers: kvigor, sshreyas Reviewed By: sshreyas Change-Id: I88e542449e3b40415cd201ff39694e86eef65a6e Reviewed-on: https://review.gluster.org/18190 Reviewed-by: Shreyas Siravara <sshreyas@fb.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-common.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
index 629f1c6a7da..800cf9705c9 100644
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
@@ -2187,6 +2187,8 @@ int
afr_selfheal (xlator_t *this, uuid_t gfid)
{
int ret = -1;
+ int parent_ret = -1;
+ int up_count = 0;
gf_boolean_t tried_parent = _gf_false;
call_frame_t *frame = NULL;
afr_local_t *local = NULL;
@@ -2196,7 +2198,7 @@ afr_selfheal (xlator_t *this, uuid_t gfid)
afr_private_t *priv = NULL;
priv = this->private;
-
+
heal_gfid:
frame = afr_frame_create (this);
@@ -2208,7 +2210,13 @@ heal_gfid:
ret = afr_selfheal_do (frame, this, gfid);
- if (priv->pgfid_self_heal == _gf_true &&
+ /* PGFID is pointless when a child is down as the heal will almost
+ * certainly fail for that reason. Instead only attempt PGFID
+ * healing when all children are present.
+ */
+ up_count = AFR_COUNT (priv->child_up, priv->child_count);
+ if (up_count == priv->child_count &&
+ priv->pgfid_self_heal == _gf_true &&
tried_parent == _gf_false && (ret != 0 || ret != 2) &&
!gf_uuid_is_null (local->heal_pgfid)) {
tried_parent = _gf_true;