summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-common.c4
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c3
-rw-r--r--xlators/cluster/afr/src/afr.c8
-rw-r--r--xlators/cluster/afr/src/afr.h1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c23
5 files changed, 33 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index d241825940f..e82eecbf03c 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -3555,10 +3555,8 @@ afr_notify (xlator_t *this, int32_t event,
ret = 0;
if (propagate)
ret = default_notify (this, event, data);
- if (call_psh && priv->shd.enabled) {
- gf_log (this->name, GF_LOG_DEBUG, "start crawl: %d", up_child);
+ if (call_psh && priv->shd.iamshd)
afr_do_poll_self_heal ((void*) (long) up_child);
- }
out:
return ret;
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index c8fb4d38ee6..34376b1853d 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -486,7 +486,8 @@ afr_do_poll_self_heal (void *data)
priv = this->private;
shd = &priv->shd;
- _do_self_heal_on_subvol (this, child, INDEX);
+ if (shd->enabled)
+ _do_self_heal_on_subvol (this, child, INDEX);
if (shd->pos[child] == AFR_POS_REMOTE)
goto out;
timeout.tv_sec = AFR_POLL_TIMEOUT;
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index da0e56ffc84..ce82aede839 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -276,6 +276,8 @@ init (xlator_t *this)
GF_OPTION_INIT ("self-heal-daemon", priv->shd.enabled, bool, out);
+ GF_OPTION_INIT ("iam-self-heal-daemon", priv->shd.iamshd, bool, out);
+
GF_OPTION_INIT ("data-change-log", priv->data_change_log, bool, out);
GF_OPTION_INIT ("metadata-change-log", priv->metadata_change_log, bool,
@@ -365,7 +367,7 @@ init (xlator_t *this)
priv->first_lookup = 1;
priv->root_inode = NULL;
- if (!priv->shd.enabled) {
+ if (!priv->shd.iamshd) {
ret = 0;
goto out;
}
@@ -574,6 +576,10 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_BOOL,
.default_value = "off",
},
+ { .key = {"iam-self-heal-daemon"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "off",
+ },
{ .key = {"quorum-type"},
.type = GF_OPTION_TYPE_STR,
.value = { "none", "auto", "fixed", "" },
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index a9162b8adc0..fc77b806e2f 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -96,6 +96,7 @@ typedef enum {
typedef struct afr_self_heald_ {
gf_boolean_t enabled;
+ gf_boolean_t iamshd;
afr_crawl_type_t *pending;
gf_boolean_t *inprogress;
afr_child_pos_t *pos;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 84222136c81..5fbef4e445e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -2465,7 +2465,7 @@ build_client_graph (volgen_graph_t *graph, glusterd_volinfo_t *volinfo,
static int
shd_option_handler (volgen_graph_t *graph, struct volopt_map_entry *vme,
- void *param)
+ void *param)
{
int ret = 0;
struct volopt_map_entry new_vme = {0};
@@ -2660,6 +2660,23 @@ nfs_option_handler (volgen_graph_t *graph,
}
static int
+volgen_graph_set_iam_shd (volgen_graph_t *graph)
+{
+ xlator_t *trav;
+ int ret = 0;
+
+ for (trav = first_of (graph); trav; trav = trav->next) {
+ if (strcmp (trav->type, "cluster/replicate") != 0)
+ continue;
+
+ ret = xlator_set_option (trav, "iam-self-heal-daemon", "yes");
+ if (ret)
+ break;
+ }
+ return ret;
+}
+
+static int
build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict)
{
volgen_graph_t cgraph = {0};
@@ -2733,6 +2750,10 @@ build_shd_graph (volgen_graph_t *graph, dict_t *mod_dict)
if (ret)
goto out;
+ ret = volgen_graph_set_iam_shd (&cgraph);
+ if (ret)
+ goto out;
+
ret = volgen_graph_merge_sub (graph, &cgraph, rclusters);
if (ret)
goto out;