diff options
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index dfa91d78501..5f85c3047d4 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -20,7 +20,8 @@ #include "event-history.h" typedef enum { - STOP_CRAWL_ON_SINGLE_SUBVOL = 1 + STOP_CRAWL_ON_SINGLE_SUBVOL = 1, + STOP_INDEX_CRAWL_ON_PENDING_FULL_CRAWL = 2 } afr_crawl_flags_t; typedef enum { @@ -668,11 +669,26 @@ afr_crawl_done (int ret, call_frame_t *sync_frame, void *data) return 0; } +int +_get_heal_op_flags (shd_crawl_op op, afr_crawl_type_t crawl) +{ + int crawl_flags = 0; + + if (HEAL == op) { + crawl_flags |= STOP_CRAWL_ON_SINGLE_SUBVOL; + + if (crawl == INDEX) + crawl_flags |= STOP_INDEX_CRAWL_ON_PENDING_FULL_CRAWL; + } + + return crawl_flags; +} + void _do_self_heal_on_subvol (xlator_t *this, int child, afr_crawl_type_t crawl) { afr_start_crawl (this, child, crawl, _self_heal_entry, - NULL, _gf_true, STOP_CRAWL_ON_SINGLE_SUBVOL, + NULL, _gf_true, _get_heal_op_flags (HEAL, crawl), afr_crawl_done); } @@ -691,6 +707,7 @@ _crawl_proceed (xlator_t *this, int child, int crawl_flags, char **reason) gf_log (this->name, GF_LOG_DEBUG, "%s", msg); goto out; } + if (!priv->child_up[child]) { gf_log (this->name, GF_LOG_DEBUG, "Stopping crawl for %s , " "subvol went down", priv->children[child]->name); @@ -707,6 +724,17 @@ _crawl_proceed (xlator_t *this, int child, int crawl_flags, char **reason) goto out; } } + + if (crawl_flags & STOP_INDEX_CRAWL_ON_PENDING_FULL_CRAWL) { + if (shd->pending[child] == FULL) { + gf_log (this->name, GF_LOG_INFO, "Stopping index " + "self-heal as Full self-heal is pending on %s", + priv->children[child]->name); + msg = "Full crawl is pending"; + goto out; + } + } + proceed = _gf_true; out: if (reason) @@ -730,8 +758,7 @@ _do_crawl_op_on_local_subvols (xlator_t *this, afr_crawl_type_t crawl, int crawl_flags = 0; priv = this->private; - if (op == HEAL) - crawl_flags |= STOP_CRAWL_ON_SINGLE_SUBVOL; + crawl_flags = _get_heal_op_flags (op, crawl); if (output) { ret = dict_get_int32 (output, this->name, &xl_id); @@ -1684,7 +1711,10 @@ afr_dir_exclusive_crawl (void *data) if (!crawl) { gf_log (this->name, GF_LOG_INFO, "Another crawl is in progress " - "for %s", priv->children[child]->name); + "for %s while attempting %s heal on %s", + priv->children[child]->name, + get_crawl_type_in_string (crawl_data->crawl), + priv->children[child]->name); goto out; } |