From 1a82b4539b69390dfb1a158c420385c7ad5d999f Mon Sep 17 00:00:00 2001 From: Pranith K Date: Fri, 17 Jun 2011 07:20:08 +0000 Subject: cluster/afr: Handle lookups when self-heal is off Signed-off-by: Pranith Kumar K Signed-off-by: Anand Avati BUG: 2586 (read child is set without checking the xattr) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2586 --- xlators/cluster/afr/src/afr-self-heal-entry.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-entry.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c index ca738098a..0425644b3 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -2157,13 +2157,15 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this) goto heal; } - afr_sh_build_pending_matrix (priv, sh->pending_matrix, sh->xattr, - priv->child_count, AFR_ENTRY_TRANSACTION); + afr_build_pending_matrix (priv->pending_key, sh->pending_matrix, + sh->xattr, AFR_ENTRY_TRANSACTION, + priv->child_count); afr_sh_print_pending_matrix (sh->pending_matrix, this); - nsources = afr_sh_mark_sources (sh, priv->child_count, - AFR_SELF_HEAL_ENTRY); + nsources = afr_mark_sources (sh->sources, sh->pending_matrix, sh->buf, + priv->child_count, AFR_SELF_HEAL_ENTRY, + sh->child_success, this->name); if (nsources == 0) { gf_log (this->name, GF_LOG_TRACE, @@ -2174,9 +2176,6 @@ afr_sh_entry_fix (call_frame_t *frame, xlator_t *this) return 0; } - afr_sh_supress_errenous_children (sh->sources, sh->child_errno, - priv->child_count); - source = afr_sh_select_source (sh->sources, priv->child_count); sh->source = source; @@ -2209,6 +2208,8 @@ afr_sh_entry_lookup_cbk (call_frame_t *frame, void *cookie, if (op_ret != -1) { sh->xattr[child_index] = dict_ref (xattr); sh->buf[child_index] = *buf; + sh->child_success[sh->success_count] = child_index; + sh->success_count++; } } UNLOCK (&frame->lock); @@ -2233,9 +2234,11 @@ afr_sh_entry_lookup (call_frame_t *frame, xlator_t *this) int ret = 0; int call_count = 0; int i = 0; + afr_self_heal_t *sh = NULL; priv = this->private; local = frame->local; + sh = &local->self_heal; call_count = afr_up_children_count (priv->child_count, local->child_up); @@ -2255,6 +2258,9 @@ afr_sh_entry_lookup (call_frame_t *frame, xlator_t *this) } } + for (i = 0; i < priv->child_count; i++) + sh->child_success[i] = -1; + sh->success_count = 0; for (i = 0; i < priv->child_count; i++) { if (local->child_up[i]) { STACK_WIND_COOKIE (frame, -- cgit