From dc450ab5e3798b47e89e90b64c49cb8e1f20efce Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Fri, 8 Aug 2014 11:52:17 +0530 Subject: cluster/afr: Fix all locked_on bricks are sinks check in self-heals Problem: Counts may give wrong results when the number of bricks is > 2. If the locks are acquired on one source and sink, but the source accuses even the down sink then there will be 2 sinks and lock is acquired on 2 bricks so even when there is a clear source and sink **_finalize_source functions think the file/directory is in split-brain. Fix: Check that all the bricks which are locked are sinks. Change-Id: Ia43790e8e1bfb5e72a3d0b56bcad94abd0dc58ab BUG: 1128721 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/8456 Reviewed-by: Ravishankar N Reviewed-by: Krutika Dhananjay Tested-by: Gluster Build System --- xlators/cluster/afr/src/afr.h | 1 + 1 file changed, 1 insertion(+) (limited to 'xlators/cluster/afr/src/afr.h') diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h index 91eef2bf1b7..35d4d545bc9 100644 --- a/xlators/cluster/afr/src/afr.h +++ b/xlators/cluster/afr/src/afr.h @@ -50,6 +50,7 @@ typedef int (*afr_changelog_resume_t) (call_frame_t *frame, xlator_t *this); #define alloca0(size) ({void *__ptr; __ptr = alloca(size); memset(__ptr, 0, size); __ptr;}) #define AFR_COUNT(array,max) ({int __i; int __res = 0; for (__i = 0; __i < max; __i++) if (array[__i]) __res++; __res;}) #define AFR_INTERSECT(dst,src1,src2,max) ({int __i; for (__i = 0; __i < max; __i++) dst[__i] = src1[__i] && src2[__i];}) +#define AFR_CMP(a1,a2,len) ({int __cmp = 0; int __i; for (__i = 0; __i < len; __i++) if (a1[__i] != a2[__i]) { __cmp = 1; break;} __cmp;}) typedef struct _afr_private { gf_lock_t lock; /* to guard access to child_count, etc */ -- cgit