summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-common.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-04-15 12:40:57 +0530
committerVijay Bellur <vbellur@redhat.com>2014-04-28 09:43:24 -0700
commit07ed48398e41df1b65202f3d2e0be6f2c3ca8ceb (patch)
tree61223ce6be2394606058b8403e0a70e40a6df9f0 /xlators/cluster/afr/src/afr-common.c
parent115b4093a44f6e23c28e5a382f82e72ddf73d97c (diff)
cluster/afr: trigger self-heals even when they are set to off.
When attempt-self-heal is set to true, trigger data/metadata/entry self-heals even when they are disabled. This is useful for gluster volume heal info to report them even when metadata-self-heal entry-self-heal, data-self-heal are set to off. Change-Id: Idc3f0d5d049c875b4f975248fef56ea2238da47c BUG: 1039544 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/7480 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/afr/src/afr-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-common.c93
1 files changed, 82 insertions, 11 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 4b39ff6039d..7dafa0529fa 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -1411,19 +1411,90 @@ afr_detect_self_heal_by_lookup_status (afr_local_t *local, xlator_t *this)
}
gf_boolean_t
-afr_can_self_heal_proceed (afr_self_heal_t *sh, afr_private_t *priv)
+afr_can_start_missing_entry_gfid_self_heal (afr_local_t *local,
+ afr_private_t *priv)
{
- GF_ASSERT (sh);
- GF_ASSERT (priv);
+ if (!local)
+ goto out;
+ //attempt self heal is only for data/metadata/entry
+ if (local->self_heal.do_gfid_self_heal ||
+ local->self_heal.do_missing_entry_self_heal)
+ return _gf_true;
+out:
+ return _gf_false;
+}
+
+gf_boolean_t
+afr_can_start_entry_self_heal (afr_local_t *local, afr_private_t *priv)
+{
+ if (!local)
+ goto out;
+ //force_confirm_spb is not checked here because directory split-brains
+ //are not reported at the moment.
+ if (local->self_heal.do_entry_self_heal) {
+ if (local->attempt_self_heal || priv->entry_self_heal)
+ return _gf_true;
+ }
+out:
+ return _gf_false;
+}
+
+gf_boolean_t
+afr_can_start_data_self_heal (afr_local_t *local, afr_private_t *priv)
+{
+ if (!local)
+ goto out;
+
+ if (local->self_heal.force_confirm_spb)
+ return _gf_true;
+
+ if (local->self_heal.do_data_self_heal) {
+ if (local->attempt_self_heal ||
+ afr_data_self_heal_enabled (priv->data_self_heal))
+ return _gf_true;
+ }
+out:
+ return _gf_false;
+}
- if (sh->force_confirm_spb)
+gf_boolean_t
+afr_can_start_metadata_self_heal (afr_local_t *local, afr_private_t *priv)
+{
+ if (!local)
+ goto out;
+ if (local->self_heal.force_confirm_spb)
return _gf_true;
- return (sh->do_gfid_self_heal
- || sh->do_missing_entry_self_heal
- || (afr_data_self_heal_enabled (priv->data_self_heal) &&
- sh->do_data_self_heal)
- || (priv->metadata_self_heal && sh->do_metadata_self_heal)
- || (priv->entry_self_heal && sh->do_entry_self_heal));
+
+ if (local->self_heal.do_metadata_self_heal) {
+ if (local->attempt_self_heal || priv->metadata_self_heal)
+ return _gf_true;
+ }
+out:
+ return _gf_false;
+}
+
+gf_boolean_t
+afr_can_self_heal_proceed (afr_local_t *local, afr_private_t *priv)
+{
+ if (!local)
+ goto out;
+
+ if (local->self_heal.force_confirm_spb)
+ return _gf_true;
+
+ if (afr_can_start_missing_entry_gfid_self_heal (local, priv))
+ return _gf_true;
+
+ if (afr_can_start_entry_self_heal (local, priv))
+ return _gf_true;
+
+ if (afr_can_start_data_self_heal (local, priv))
+ return _gf_true;
+
+ if (afr_can_start_metadata_self_heal (local, priv))
+ return _gf_true;
+out:
+ return _gf_false;
}
afr_transaction_type
@@ -1840,7 +1911,7 @@ 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_can_self_heal_proceed (local, priv)) {
if (afr_is_transaction_running (local) &&
(!local->attempt_self_heal))
goto out;