summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-self-heal-name.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2017-01-23 14:58:45 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-02-16 10:24:31 -0500
commit6588204568ab73bf8456ca3b2eccf2ae1182fb95 (patch)
treec36df3d8b6f23bba37620d1d6508c81f4389cbe5 /xlators/cluster/afr/src/afr-self-heal-name.c
parent267578ec0d6b29483a1bd402165ea8c388ad825e (diff)
cluster/afr: Perform new entry mark before creating new entry
There is a chance for the source brick to go down just after the new entry is created and before source brick is marked with necessary pending markers. If after this any I/O happens then new entry will become source and reverse heal will happen. To prevent this mark the pending xattrs before creating the new entry. BUG: 1417466 Change-Id: I233b87e694d32e5d734df5a83b4d2ca711c17503 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: https://review.gluster.org/16474 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Ravishankar N <ravishankar@redhat.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-name.c')
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-name.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
index ebeb698996b..8372cb6e376 100644
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
@@ -110,12 +110,10 @@ __afr_selfheal_name_impunge (call_frame_t *frame, xlator_t *this,
int i = 0;
afr_private_t *priv = NULL;
int ret = 0;
- unsigned char *newentry = NULL;
unsigned char *sources = NULL;
priv = this->private;
- newentry = alloca0 (priv->child_count);
sources = alloca0 (priv->child_count);
gf_uuid_copy (parent->gfid, pargfid);
@@ -129,15 +127,17 @@ __afr_selfheal_name_impunge (call_frame_t *frame, xlator_t *this,
sources[i] = 1;
continue;
}
+ }
+
+ for (i = 0; i < priv->child_count; i++) {
+ if (sources[i])
+ continue;
- ret |= afr_selfheal_recreate_entry (this, i, gfid_idx, parent,
- bname, inode, replies,
- newentry);
+ ret |= afr_selfheal_recreate_entry (frame, i, gfid_idx, sources,
+ parent, bname, inode,
+ replies);
}
- if (AFR_COUNT (newentry, priv->child_count))
- afr_selfheal_newentry_mark (frame, this, inode, gfid_idx, replies,
- sources, newentry);
return ret;
}
@@ -484,8 +484,7 @@ __afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent,
}
ret = __afr_selfheal_name_impunge (frame, this, parent, pargfid,
- bname, inode,
- replies, gfid_idx);
+ bname, inode, replies, gfid_idx);
if (ret == -EIO)
ret = -1;