diff options
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 4480140b5..a2c2e34ce 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -437,6 +437,27 @@ afr_sh_mark_biggest_as_source (afr_self_heal_t *sh, int child_count) } +static int +afr_sh_mark_lowest_uid_as_source (afr_self_heal_t *sh, int child_count) +{ + uid_t smallest = 0; + int i; + + for (i = 0; i < child_count; i++) { + if (!sh->buf) + break; + + if (sh->buf[i].st_uid < sh->buf[smallest].st_uid) { + smallest = i; + } + } + + sh->sources[smallest] = 1; + + return 1; +} + + int afr_sh_mark_sources (afr_self_heal_t *sh, int child_count, afr_self_heal_type type) @@ -486,6 +507,13 @@ afr_sh_mark_sources (afr_self_heal_t *sh, int child_count, size_differs = afr_sh_mark_if_size_differs (sh, child_count); } + if ((type == AFR_SELF_HEAL_METADATA) + && afr_sh_all_nodes_innocent (characters, child_count)) { + + nsources = afr_sh_mark_lowest_uid_as_source (sh, child_count); + goto out; + } + if (afr_sh_all_nodes_innocent (characters, child_count)) { if (size_differs) { nsources = afr_sh_mark_biggest_as_source (sh, |