diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2017-01-23 14:58:45 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2017-03-11 13:09:59 -0500 |
commit | c495bbc95cb95797bba1b62d0a49e58f2ed4bd63 (patch) | |
tree | b50aa50e25c5ccddcf2274343f1815549a3019ce /xlators/cluster/afr/src/afr-self-heal-common.c | |
parent | f9aaa26332ba7007265967bc29a1a2a99234a26d (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>
BUG: 1429312
Change-Id: Ia1bdaf9511acaeff72a336c8185a56a64ea0e2ba
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: https://review.gluster.org/16850
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-self-heal-common.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-common.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index a70833174c0..6d1ae1312ea 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -26,6 +26,8 @@ afr_selfheal_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local = frame->local; + local->op_ret = op_ret; + local->op_errno = op_errno; syncbarrier_wake (&local->barrier); return 0; @@ -39,6 +41,7 @@ afr_selfheal_post_op (call_frame_t *frame, xlator_t *this, inode_t *inode, afr_private_t *priv = NULL; afr_local_t *local = NULL; loc_t loc = {0, }; + int ret = 0; priv = this->private; local = frame->local; @@ -46,15 +49,20 @@ afr_selfheal_post_op (call_frame_t *frame, xlator_t *this, inode_t *inode, loc.inode = inode_ref (inode); gf_uuid_copy (loc.gfid, inode->gfid); + local->op_ret = 0; + STACK_WIND (frame, afr_selfheal_post_op_cbk, priv->children[subvol], priv->children[subvol]->fops->xattrop, &loc, GF_XATTROP_ADD_ARRAY, xattr, xdata); syncbarrier_wait (&local->barrier, 1); + if (local->op_ret < 0) + ret = -local->op_errno; loc_wipe (&loc); + local->op_ret = 0; - return 0; + return ret; } int @@ -1977,13 +1985,16 @@ afr_selfheal_newentry_mark (call_frame_t *frame, xlator_t *this, inode_t *inode, changelog = afr_mark_pending_changelog (priv, newentry, xattr, replies[source].poststat.ia_type); - if (!changelog) + if (!changelog) { + ret = -ENOMEM; goto out; + } for (i = 0; i < priv->child_count; i++) { if (!sources[i]) continue; - afr_selfheal_post_op (frame, this, inode, i, xattr, NULL); + ret |= afr_selfheal_post_op (frame, this, inode, i, xattr, + NULL); } out: if (changelog) |