summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorShyamsundarR <srangana@redhat.com>2014-01-28 11:09:10 +0530
committerVijay Bellur <vbellur@redhat.com>2014-02-04 09:56:57 -0800
commit0c721c4c046d3580f7774eb480ff139c3ef814b5 (patch)
treeabd084f60c29d4035be412872033f88062872c6f /xlators/cluster/dht
parent21a83b8be06aa73f40b83b9cfc97dc8a1972190a (diff)
cluster/dht: Set restrictive open flags for files under rebalance
Files that are being rebalanced are created in the new volume and access path needs to open these files to write changing data in parallel to both the old and new locations. While opening the file in the new location, we need to restrict the open flags to not use truncate or create and fail if exist flags, to prevent open failures or inadvertently truncate the file under rebalance. Change-Id: I12130e0377adc393f1925c45585200ad991fd0d5 BUG: 1058569 Signed-off-by: ShyamsundarR <srangana@redhat.com> Reviewed-on: http://review.gluster.org/6830 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-helper.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 381643b22..18a501f04 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -884,8 +884,12 @@ dht_migration_complete_check_task (void *data)
if (fd_is_anonymous (iter_fd))
continue;
+ /* flags for open are stripped down to allow following the
+ * new location of the file, otherwise we can get EEXIST or
+ * truncate the file again as rebalance is moving the data */
ret = syncop_open (dst_node, &tmp_loc,
- iter_fd->flags, iter_fd);
+ (iter_fd->flags &
+ ~(O_CREAT | O_EXCL | O_TRUNC)), iter_fd);
if (ret < 0) {
gf_log (this->name, GF_LOG_ERROR, "failed to open "
"the fd (%p, flags=0%o) on file %s @ %s",
@@ -1034,8 +1038,12 @@ dht_rebalance_inprogress_task (void *data)
if (fd_is_anonymous (iter_fd))
continue;
+ /* flags for open are stripped down to allow following the
+ * new location of the file, otherwise we can get EEXIST or
+ * truncate the file again as rebalance is moving the data */
ret = syncop_open (dst_node, &tmp_loc,
- iter_fd->flags, iter_fd);
+ (iter_fd->flags &
+ ~(O_CREAT | O_EXCL | O_TRUNC)), iter_fd);
if (ret < 0) {
gf_log (this->name, GF_LOG_ERROR, "failed to send open "
"the fd (%p, flags=0%o) on file %s @ %s",