summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-07-13 06:00:13 +0000
committerAnand Avati <avati@gluster.com>2011-07-17 07:47:18 -0700
commit1a807fec3992fcff9bfbc410f0a21a5794d04f7a (patch)
treee06aeab5564556e7586d4a71ab3417bfab5948e2
parentd49e1257798f390cd894f0c4b23030ac5726c348 (diff)
cluster/afr: previous read_child should take precedence over priv->read_child
Lookup uses the sources array to decide if a child is read_child or not. So if afr_mark_sources returns 0 i.e. all children are sources, explicitly mark them as sources. Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 3138 ([release-3.2]: ls shows 2 entries) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3138
-rw-r--r--xlators/cluster/afr/src/afr-common.c4
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-data.c8
2 files changed, 10 insertions, 2 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index 6733cb314..83f6e530e 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -679,7 +679,7 @@ afr_lookup_set_read_child (xlator_t *this, afr_local_t *local)
if (!sh->sources)
goto out;
- read_child = priv->read_child;
+ read_child = local->read_child_index;
if (afr_is_valid_read_child (sh->sources, priv->child_count,
read_child))
goto out;
@@ -912,6 +912,8 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
afr_set_read_child (this,
local->cont.lookup.inode,
child_index);
+ //prefer fast child
+ local->read_child_index = child_index;
}
} else {
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
index d4516c4ce..f58a03d84 100644
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
@@ -705,6 +705,8 @@ afr_self_heal_find_sources (xlator_t *this, afr_local_t *local, dict_t **xattr,
afr_private_t *priv = NULL;
int i = 0;
+ int nsources = 0;
+
afr_self_heal_type sh_type = AFR_SELF_HEAL_DATA;
sh = &local->self_heal;
@@ -738,7 +740,11 @@ afr_self_heal_find_sources (xlator_t *this, afr_local_t *local, dict_t **xattr,
sh_type = AFR_SELF_HEAL_METADATA;
break;
}
- (void)afr_sh_mark_sources (sh, priv->child_count, sh_type);
+ nsources = afr_sh_mark_sources (sh, priv->child_count, sh_type);
+ if (nsources == 0) {
+ for (i = 0; i < priv->child_count; i++)
+ sh->sources[i] = 1;
+ }
}