From 3bad56d0d39e132b43d0122a570ba1b59a9a7caa Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 4 Feb 2011 01:29:08 +0000 Subject: gluster rebalance: fix the permission issue of rebalanced files Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 2369 (Rebalanced files written as root:root on any brick) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2369 --- xlators/mgmt/glusterd/src/glusterd-rebalance.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'xlators') diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 3e4b4f5a26c..a8a063706fb 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -128,6 +128,20 @@ gf_glusterd_rebalance_move_data (glusterd_volinfo_t *volinfo, const char *dir) if (new_stbuf.st_mtime != stbuf.st_mtime) continue; + ret = fchmod (dst_fd, stbuf.st_mode); + if (ret) { + gf_log ("", GF_LOG_WARNING, + "failed to set the mode of file %s: %s", + tmp_filename, strerror (errno)); + } + + ret = fchown (dst_fd, stbuf.st_uid, stbuf.st_gid); + if (ret) { + gf_log ("", GF_LOG_WARNING, + "failed to set the uid/gid of file %s: %s", + tmp_filename, strerror (errno)); + } + ret = rename (tmp_filename, full_path); if (ret != -1) { LOCK (&defrag->lock); -- cgit