summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2015-12-17 17:41:08 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-01-28 17:43:33 -0800
commitb43aa481712dab5df813050119ba6c08f50dbfd9 (patch)
treeb44b2b5cc796c9de331d3d7c0046367c1a162100 /xlators/storage/posix/src/posix.c
parentf5ff11159544aa16b44965a0ce4500e9c615895d (diff)
cluster/afr: Fix data loss due to race between sh and ongoing write.
Backport of: http://review.gluster.org/#/c/13001/ Problem: When IO is happening on a file and a brick goes down comes back up during this time, protocol/client translator attempts reopening of the fd on the gfid handle of the file. But if another client renames this file while a brick was down && writes were in progress on it, once this brick is back up, there can be a race between reopening of the fd and entry self-heal replaying the effect of the rename() on the sink brick. If the reopening of the fd happens first, the application's writes continue to go into the data blocks associated with the gfid. Now entry-self-heal deletes 'src' and creates 'dst' file on the sink, marking dst as a 'newentry'. Data self-heal is also completed on 'dst' as a result and self-heal terminates. If at this point the application is still writing to this fd, all writes on the file after self-heal would go into the data blocks associated with this fd, which would be lost once the fd is closed. The result - the 'dst' file on the source and sink are not the same and there is no pending heal on the file, leading to silent corruption on the sink. Fix: Leverage http://review.gluster.org/#/c/12816/ to ensure the gfid handle path gets saved in .glusterfs/unlink until the fd is closed on the file. During this time, when self-heal sends mknod() with gfid of the file, do the following: link() the gfid handle under .glusterfs/unlink to the new path to be created in mknod() and rename() the gfid handle to go back under .glusterfs/ab/cd/. Change-Id: I5dc49c127ef0a1bf3cf4ce1b24610b1527f84d6f BUG: 1293265 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: http://review.gluster.org/13036 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index d57d53d5fca..fe0607f09cd 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1196,7 +1196,8 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
goto real_op;
}
op_ret = posix_create_link_if_gfid_exists (this, uuid_req,
- real_path);
+ real_path,
+ loc->inode->table);
if (!op_ret) {
linked = _gf_true;
goto post_op;