summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2012-11-01 17:19:04 +0530
committerVijay Bellur <vbellur@redhat.com>2012-11-05 02:27:42 -0800
commit775626f44f30e38cccd5efcd959b61f4f0f61969 (patch)
tree32325a11cae907d34a64d63fed0c26b44d54ac26
parent251a0056e35ea5d4c1ef4d5eede15e67c7428469 (diff)
cluster/afr: Filter O_TRUNC in afr-fix-open
RCA: When open was done while a brick is down, afr opens the file after the brick comes backup. If this happens after the self-heal on the file is completed by self-heald etc, the file will end up in truncated state. Fix: Filter O_TRUNC while afr-fix-open because afr_open turns O_TRUNC into truncate transaction, so there will be pending changelog for the subvolume on which open fails. Testing: Had to simulate the race by stopping fix-open until self-heald completes self-heal on the file after brick online. Change-Id: If99eb3eb272dea0ed8c7b754dce675eb6efaf802 BUG: 841840 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/4147 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r--xlators/cluster/afr/src/afr-open.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-open.c b/xlators/cluster/afr/src/afr-open.c
index 35090d80e4b..c0be197f212 100644
--- a/xlators/cluster/afr/src/afr-open.c
+++ b/xlators/cluster/afr/src/afr-open.c
@@ -429,7 +429,8 @@ afr_fix_open (call_frame_t *frame, xlator_t *this, afr_fd_ctx_t *fd_ctx,
(void *)(long) i,
priv->children[i],
priv->children[i]->fops->open,
- &open_local->loc, fd_ctx->flags,
+ &open_local->loc,
+ fd_ctx->flags & (~O_TRUNC),
open_local->fd, NULL);
}