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>
This commit is contained in:
parent
21a83b8be0
commit
0c721c4c04
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user