summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-transaction.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-11-20 09:13:14 +0530
committerVijay Bellur <vijay@gluster.com>2011-11-28 07:48:43 -0800
commitf52dd9bf2005449f49acd5666a02594fb4c5ac6f (patch)
tree0c0b5c7e97009a1df0aaef76b9339978aeb508c7 /xlators/cluster/afr/src/afr-transaction.c
parent7ae082e9c519ea91540c4d49f9df44c4e6e9f39a (diff)
cluster/afr: Update read-child if it becomes stale
Change-Id: I00c714a89575023f6dbdd3430dcbf191e5d08019 BUG: 3650 Reviewed-on: http://review.gluster.com/740 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-transaction.c')
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index d3960dcff40..89fbd9ec754 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -382,44 +382,38 @@ afr_transaction_rm_stale_children (call_frame_t *frame, xlator_t *this,
local = frame->local;
pending = local->pending;
- stale_children = afr_children_create (priv->child_count);
- if (!stale_children)
+ if (local->op_ret < 0)
goto out;
-
fresh_children = local->fresh_children;
read_child = afr_inode_get_read_ctx (this, inode, fresh_children);
-
- GF_ASSERT (read_child >= 0);
-
- if (pending[read_child][idx] == 0)
- read_child = -1;
+ if (read_child < 0) {
+ gf_log (this->name, GF_LOG_DEBUG, "Possible split-brain "
+ "for %s", uuid_utoa (inode->gfid));
+ goto out;
+ }
for (i = 0; i < priv->child_count; i++) {
if (!afr_is_child_present (fresh_children,
priv->child_count, i))
continue;
- if (pending[i][idx] == 0) {
- /* child is down or op failed on it */
- rm_stale_children = _gf_true;
- afr_children_rm_child (fresh_children, i,
- priv->child_count);
- stale_children[count++] = i;
- }
- }
+ if (pending[i][idx])
+ continue;
+ /* child is down or op failed on it */
+ if (!stale_children)
+ stale_children = afr_children_create (priv->child_count);
+ if (!stale_children)
+ goto out;
- if (!rm_stale_children) {
- GF_ASSERT (read_child >= 0);
- goto out;
+ rm_stale_children = _gf_true;
+ stale_children[count++] = i;
+ gf_log (this->name, GF_LOG_DEBUG, "Removing stale child "
+ "%d for %s", i, uuid_utoa (inode->gfid));
}
- if (fresh_children[0] == -1) {
- //All children failed. leave as-is
+ if (!rm_stale_children)
goto out;
- }
- if (read_child == -1)
- read_child = fresh_children[0];
- afr_inode_rm_stale_children (this, inode, read_child, stale_children);
+ afr_inode_rm_stale_children (this, inode, stale_children);
out:
if (stale_children)
GF_FREE (stale_children);