diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-04-06 05:21:29 -0700 |
---|---|---|
committer | Anand V. Avati <avati@amp.gluster.com> | 2009-04-06 22:04:48 +0530 |
commit | 258fec70ba2cc588f500f3e3bc16c99af212b4c9 (patch) | |
tree | a87c7c365383674f7b20a40c74fec5a25be3b9df | |
parent | 6b18487d2811b4fb004d0f4c5c98a101a93b35ed (diff) |
Fix in return value of afr_sh_mark_sources
afr_sh_mark_sources now returns:
-1 if two wise subvols conflict (split-brain)
0 if all subvols are innocent (no self-heal needed)
>0 if sources found
Also, changes to callers of afr_sh_mark_sources to handle return
value properly.
Signed-off-by: Anand V. Avati <avati@amp.gluster.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 2 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-data.c | 17 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-metadata.c | 17 |
3 files changed, 26 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 04530ccb0..518907ac7 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -446,6 +446,8 @@ afr_sh_mark_sources (int32_t *pending_matrix[], int sources[], int child_count) if (afr_sh_wise_nodes_conflict (characters, child_count)) { /* split-brain */ + + nsources = -1; goto out; } else { diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 775845fe6..bc13a43ab 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -778,8 +778,8 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) afr_sh_print_pending_matrix (sh->pending_matrix, this); - afr_sh_mark_sources (sh->pending_matrix, sh->sources, - priv->child_count); + nsources = afr_sh_mark_sources (sh->pending_matrix, sh->sources, + priv->child_count); afr_sh_supress_empty_children (sh->sources, sh->xattr, sh->buf, priv->child_count, AFR_DATA_PENDING); @@ -787,9 +787,16 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) afr_sh_supress_errenous_children (sh->sources, sh->child_errno, priv->child_count); - nsources = afr_sh_source_count (sh->sources, priv->child_count); + if (nsources == 0) { + gf_log (this->name, GF_LOG_DEBUG, + "No self-heal needed for %s", + local->loc.path); - if ((nsources == 0) + afr_sh_data_finish (frame, this); + return 0; + } + + if ((nsources == -1) && (priv->favorite_child != -1) && (sh->child_errno[priv->favorite_child] == 0)) { @@ -804,7 +811,7 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) priv->child_count); } - if (nsources == 0) { + if (nsources == -1) { gf_log (this->name, GF_LOG_ERROR, "Unable to resolve conflicting data of %s. " "Please resolve manually by deleting the file %s " diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index de8fa1a39..4e58c5440 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -519,15 +519,22 @@ afr_sh_metadata_fix (call_frame_t *frame, xlator_t *this) afr_sh_print_pending_matrix (sh->pending_matrix, this); - afr_sh_mark_sources (sh->pending_matrix, sh->sources, - priv->child_count); + nsources = afr_sh_mark_sources (sh->pending_matrix, sh->sources, + priv->child_count); afr_sh_supress_errenous_children (sh->sources, sh->child_errno, priv->child_count); - nsources = afr_sh_source_count (sh->sources, priv->child_count); + if (nsources == 0) { + gf_log (this->name, GF_LOG_DEBUG, + "No self-heal needed for %s", + local->loc.path); - if ((nsources == 0) + afr_sh_metadata_finish (frame, this); + return 0; + } + + if ((nsources == -1) && (priv->favorite_child != -1) && (sh->child_errno[priv->favorite_child] == 0)) { @@ -542,7 +549,7 @@ afr_sh_metadata_fix (call_frame_t *frame, xlator_t *this) priv->child_count); } - if (nsources == 0) { + if (nsources == -1) { gf_log (this->name, GF_LOG_ERROR, "Unable to resolve conflicting metadata of %s. " "Please resolve manually by fixing the " |