summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-helper.c
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-02-14 13:04:58 +0530
committerVijay Bellur <vbellur@redhat.com>2013-03-04 02:42:30 -0800
commitcd4736baba8a60d007bff6ed633f9feba9862bfb (patch)
treed11abb8bdbe588cb2f79546e0b0b6d0aebf66878 /xlators/cluster/dht/src/dht-helper.c
parent184adfd07e437d9531ebea88208d14c11f51137e (diff)
cluster/distribute: Reopen fds in migration internally as root:root
Though linkfile_create and rebalance dst file create sent a setattr with correct ownership, there is still a race window where the linkfile open (client open due to migration) will fail, as its ownership will be root:root. BUG: 884597 Change-Id: Iba73681eae4f280d39ee6c9a40009e195768bee7 Signed-off-by: shishir gowda <sgowda@redhat.com> Reviewed-on: http://review.gluster.org/4612 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-helper.c')
-rw-r--r--xlators/cluster/dht/src/dht-helper.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 9e71c6033..ecd06e394 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -731,6 +731,10 @@ dht_migration_complete_check_task (void *data)
goto out;
}
+ /* perform open as root:root. There is window between linkfile
+ * creation(root:root) and setattr with the correct uid/gid
+ */
+ SYNCTASK_SETID(0, 0);
/* if 'local->fd' (ie, fd based operation), send a 'open()' on
destination if not already done */
if (local->loc.inode) {
@@ -746,6 +750,7 @@ dht_migration_complete_check_task (void *data)
GF_FREE (path);
}
+ SYNCTASK_SETID (frame->root->uid, frame->root->gid);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
"%s: failed to send open() on target file at %s",
@@ -853,7 +858,10 @@ dht_rebalance_inprogress_task (void *data)
}
ret = 0;
-
+ /* perform open as root:root. There is window between linkfile
+ * creation(root:root) and setattr with the correct uid/gid
+ */
+ SYNCTASK_SETID (0, 0);
if (local->loc.inode) {
ret = syncop_open (dst_node, &local->loc,
local->fd->flags, local->fd);
@@ -874,6 +882,7 @@ dht_rebalance_inprogress_task (void *data)
goto out;
}
+ SYNCTASK_SETID (frame->root->uid, frame->root->gid);
ret = fd_ctx_set (local->fd, this, (uint64_t)(long)dst_node);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,