summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-name.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-08-20 21:50:06 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2014-10-01 03:29:12 -0700
commit443e48abf9b373bb1a8c56d016aad3b974554b80 (patch)
tree4a7124ff1c959d11c275dec9a0906519694e37ed /xlators/cluster/afr/src/afr-self-heal-name.c
parentf95a25c35e1ced6a3c05030d34555b757b14e1c9 (diff)
cluster/afr: Add afr-v1 xattr compatibility
All the special cases v1 handles and also self-accusing pending changelog from v1 pre-op also is handled in this patch. Change-Id: Ie10f71633fb20276f01ecafbd728f20483e7029c BUG: 1128721 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8536 Reviewed-by: Ravishankar N <ravishankar@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-name.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index c5d126185c7..af635f06d52 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -457,7 +457,9 @@ __afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent,
int
__afr_selfheal_name_finalize_source (xlator_t *this, unsigned char *sources,
unsigned char *healed_sinks,
- unsigned char *locked_on)
+ unsigned char *locked_on,
+ struct afr_reply *replies,
+ uint64_t *witness)
{
int i = 0;
afr_private_t *priv = NULL;
@@ -469,7 +471,9 @@ __afr_selfheal_name_finalize_source (xlator_t *this, unsigned char *sources,
sources_count = AFR_COUNT (sources, priv->child_count);
if ((AFR_CMP (locked_on, healed_sinks, priv->child_count) == 0)
- || !sources_count) {
+ || !sources_count || afr_does_witness_exist (this, witness)) {
+ memset (sources, 0, sizeof (*sources) * priv->child_count);
+ afr_mark_active_sinks (this, sources, locked_on, healed_sinks);
return -1;
}
@@ -483,7 +487,6 @@ __afr_selfheal_name_finalize_source (xlator_t *this, unsigned char *sources,
return source;
}
-
int
__afr_selfheal_name_prepare (call_frame_t *frame, xlator_t *this, inode_t *parent,
uuid_t pargfid, unsigned char *locked_on,
@@ -494,6 +497,7 @@ __afr_selfheal_name_prepare (call_frame_t *frame, xlator_t *this, inode_t *paren
int source = -1;
afr_private_t *priv = NULL;
struct afr_reply *replies = NULL;
+ uint64_t *witness = NULL;
priv = this->private;
@@ -503,8 +507,10 @@ __afr_selfheal_name_prepare (call_frame_t *frame, xlator_t *this, inode_t *paren
if (ret)
goto out;
- ret = afr_selfheal_find_direction (this, replies, AFR_ENTRY_TRANSACTION,
- locked_on, sources, sinks);
+ witness = alloca0 (sizeof (*witness) * priv->child_count);
+ ret = afr_selfheal_find_direction (frame, this, replies,
+ AFR_ENTRY_TRANSACTION,
+ locked_on, sources, sinks, witness);
if (ret)
goto out;
@@ -519,7 +525,9 @@ __afr_selfheal_name_prepare (call_frame_t *frame, xlator_t *this, inode_t *paren
AFR_INTERSECT (healed_sinks, sinks, locked_on, priv->child_count);
source = __afr_selfheal_name_finalize_source (this, sources,
- healed_sinks, locked_on);
+ healed_sinks,
+ locked_on, replies,
+ witness);
if (source < 0) {
/* If source is < 0 (typically split-brain), we perform a
conservative merge of entries rather than erroring out */