summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-04-26 15:33:42 +0530
committerVijay Bellur <vbellur@redhat.com>2013-05-31 05:12:58 -0700
commitf162456794ae78d29edc42a2c040c1037145f24d (patch)
tree8924c9e9862775a0f57cd1f37aac6840598d8950 /xlators/cluster/dht
parentafd669d6bde01020259ec57298c8335bc2542e4a (diff)
cluster/dht: getxattr linkto as root:root
In path based op's like truncate, we use getxattr instead of fgetxattr call. These can fail with permission denied issues as linkto file creation, and setattr of ownership is not atomic, and in cases where setattr failed (subvols down..) The fix is to perform getxattr as root:root as it is a internal fop. fgetxattr, bypass the access check, as it already has a valid open fd. Change-Id: Ie221c9172e3c1c7ed4e50c8782d362826910756f BUG: 957074 Signed-off-by: shishir gowda <sgowda@redhat.com> Reviewed-on: http://review.gluster.org/4890 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-helper.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 52a24acc22a..56c139aa911 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -709,13 +709,18 @@ dht_migration_complete_check_task (void *data)
if (!local->loc.inode && !local->fd)
goto out;
- /* getxattr on cached_subvol for 'linkto' value */
- if (!local->loc.inode)
+ /* getxattr on cached_subvol for 'linkto' value. Do path based getxattr
+ * as root:root. If a fd is already open, access check wont be done*/
+
+ if (!local->loc.inode) {
ret = syncop_fgetxattr (src_node, local->fd, &dict,
conf->link_xattr_name);
- else
+ } else {
+ SYNCTASK_SETID (0, 0);
ret = syncop_getxattr (src_node, &local->loc, &dict,
conf->link_xattr_name);
+ SYNCTASK_SETID (frame->root->uid, frame->root->gid);
+ }
if (!ret)
dst_node = dht_linkfile_subvol (this, NULL, NULL, dict);
@@ -889,13 +894,17 @@ dht_rebalance_inprogress_task (void *data)
if (!local->loc.inode && !local->fd)
goto out;
- /* getxattr on cached_subvol for 'linkto' value */
- if (local->loc.inode)
+ /* getxattr on cached_subvol for 'linkto' value. Do path based getxattr
+ * as root:root. If a fd is already open, access check wont be done*/
+ if (local->loc.inode) {
+ SYNCTASK_SETID (0, 0);
ret = syncop_getxattr (src_node, &local->loc, &dict,
conf->link_xattr_name);
- else
+ SYNCTASK_SETID (frame->root->uid, frame->root->gid);
+ } else {
ret = syncop_fgetxattr (src_node, local->fd, &dict,
conf->link_xattr_name);
+ }
if (ret) {
gf_log (this->name, GF_LOG_ERROR,