From cd05e036117a27377af8ff4a1cdba09f1de0a8eb Mon Sep 17 00:00:00 2001 From: Anuradha Date: Thu, 11 Jun 2015 14:58:05 +0530 Subject: cluster/afr : set pending xattrs for replaced brick This patch is part two change to prevent data loss in a replicate volume on doing a replace-brick commit force operation. Problem: After doing replace-brick commit force, there is a chance that self heal might happen from the replaced (sink) brick rather than the source brick leading to data loss. Solution: Mark pending changelogs on afr children for the replaced afr-child so that heal is performed in the correct direction. Change-Id: Icb9807e49b4c1c4f1dcab115318d9a58ccf95675 BUG: 1207829 Signed-off-by: Anuradha Talur Reviewed-on: http://review.gluster.org/10448 Reviewed-by: Pranith Kumar Karampuri Tested-by: NetBSD Build System Reviewed-by: Krutika Dhananjay --- xlators/cluster/afr/src/afr-self-heal-entry.c | 7 +++++++ 1 file changed, 7 insertions(+) (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 28e332db740..b593c8054c0 100644 --- a/xlators/cluster/afr/src/afr-self-heal-entry.c +++ b/xlators/cluster/afr/src/afr-self-heal-entry.c @@ -290,6 +290,13 @@ __afr_selfheal_merge_dirent (call_frame_t *frame, xlator_t *this, fd_t *fd, return 0; } + /* Set all the sources as 1, otheriwse newentry_mark won't be set */ + for (i = 0; i < priv->child_count; i++) { + if (replies[i].valid && replies[i].op_ret == 0) { + sources[i] = 1; + } + } + /* In case of a gfid or type mismatch on the entry, return -1.*/ ret = afr_selfheal_detect_gfid_and_type_mismatch (this, replies, fd->inode->gfid, -- cgit