summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-linkfile.c
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-05-16 19:32:49 +0530
committerVijay Bellur <vbellur@redhat.com>2013-05-16 08:49:39 -0700
commit1a7e6053d3842761f946fbbdd693c72aa3945a97 (patch)
treefe459937358109e966a5ac615adbeb590a359119 /xlators/cluster/dht/src/dht-linkfile.c
parentddc0b45c4d4826e86500740f672892eeb28ab325 (diff)
cluster/dht: Linkfiles creation with correct uid/gidv3.3.2qa3
If renames are done with different uid/gid (non-owners), then we would end up with incorrect uid/gid. The fix is to create linkfiles, and heal the uid/gid as root:root. This preserves our notion of creation as root:root and heal the uid/gid as root:root in all paths. Additionally, we need to consider uid/gid from only src_cached subvol, and not from linkfiles. rename is also done as root:root if done on linkfile, as setattr of ownership on linkfile is done after the rename BUG: 884597 Change-Id: Ifaacd8dba0f39cb909761ffc8fe7e06cd44ec8de Signed-off-by: shishir gowda <sgowda@redhat.com> Reviewed-on: http://review.gluster.org/5025 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-linkfile.c')
-rw-r--r--xlators/cluster/dht/src/dht-linkfile.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index 67d6ce583..9de370341 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -34,6 +34,8 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!op_ret)
local->linked = _gf_true;
+ FRAME_SU_UNDO (frame, dht_local_t);
+
local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno,
inode, stbuf, preparent, postparent,
xdata);
@@ -87,6 +89,9 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
}
local->link_subvol = fromvol;
+ /* Always create as root:root. dht_linkfile_attr_heal fixes the
+ * ownsership */
+ FRAME_SU_DO (frame, dht_local_t);
STACK_WIND (frame, dht_linkfile_create_cbk,
fromvol, fromvol->fops->mknod, loc,
S_IFREG | DHT_LINKFILE_MODE, 0, 0, dict);
@@ -252,6 +257,8 @@ dht_linkfile_attr_heal (call_frame_t *frame, xlator_t *this)
copy->local = copy_local;
+ FRAME_SU_DO (copy, dht_local_t);
+
STACK_WIND (copy, dht_linkfile_setattr_cbk, subvol,
subvol->fops->setattr, &copy_local->loc,
&stbuf, (GF_SET_ATTR_UID | GF_SET_ATTR_GID), NULL);