From 8543529f381d16349662269342d55ab67a1a4582 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 26 Dec 2011 10:10:13 +0530 Subject: cluster/afr: Handle split-brain/all-fool xattrs for directory In case of split-brain/all-fool xattrs perform conservative merge. Don't treat ignorant subvol as fool. Change-Id: I6ddf89949cd5793c2abbead7c47f091e8461f1d4 BUG: 765528 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.com/2521 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/cluster/afr/src/afr-self-heal-data.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/afr/src/afr-self-heal-data.c') diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c index 431cef492..83920c081 100644 --- a/xlators/cluster/afr/src/afr-self-heal-data.c +++ b/xlators/cluster/afr/src/afr-self-heal-data.c @@ -662,7 +662,7 @@ afr_sh_data_fix (call_frame_t *frame, xlator_t *this) frame->root->lk_owner); nsources = afr_build_sources (this, sh->xattr, sh->buf, sh->pending_matrix, sh->sources, sh->success_children, - AFR_DATA_TRANSACTION); + AFR_DATA_TRANSACTION, NULL, _gf_false); if (nsources == 0) { gf_log (this->name, GF_LOG_DEBUG, "No self-heal needed for %s", @@ -806,6 +806,7 @@ afr_lookup_select_read_child_by_txn_type (xlator_t *this, afr_local_t *local, int32_t nsources = 0; int32_t prev_read_child = -1; int32_t config_read_child = -1; + int32_t subvol_status = 0; priv = this->private; bufs = local->cont.lookup.bufs; @@ -819,7 +820,11 @@ afr_lookup_select_read_child_by_txn_type (xlator_t *this, afr_local_t *local, memset (sources, 0, sizeof (*sources) * priv->child_count); nsources = afr_build_sources (this, xattr, bufs, pending_matrix, - sources, success_children, txn_type); + sources, success_children, txn_type, + &subvol_status, _gf_false); + if (subvol_status & SPLIT_BRAIN) + gf_log (this->name, GF_LOG_WARNING, "%s: Possible split-brain", + local->loc.path); if (nsources < 0) goto out; @@ -991,7 +996,7 @@ afr_post_sh_data_fxattrop_cbk (call_frame_t *frame, void *cookie, (void) afr_build_sources (this, sh->xattr, NULL, sh->pending_matrix, sh->sources, sh->success_children, - AFR_DATA_TRANSACTION); + AFR_DATA_TRANSACTION, NULL, _gf_false); ret = afr_sh_inode_set_read_ctx (sh, this); if (ret) afr_sh_data_fail (frame, this); -- cgit