diff options
author | shishir gowda <sgowda@redhat.com> | 2013-02-14 13:04:58 +0530 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2013-02-14 20:26:58 -0800 |
commit | c87472e200c9fee74705a350ce45557bde47b946 (patch) | |
tree | 491f8add83467bdd2b56e1686841cc4bf8c8301e | |
parent | 5d29e598665456b2b7250fdca14de7409098877a (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.
Change-Id: I056092da6102319efa3bb9f1795f8c97db2a3fed
BUG: 884597
Signed-off-by: shishir gowda <sgowda@redhat.com>
Reviewed-on: http://review.gluster.org/4513
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-helper.c | 11 |
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 9e71c6033f0..ecd06e394da 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, |