summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-09-30 12:53:16 +0530
committerVijay Bellur <vijay@gluster.com>2011-09-30 00:57:05 -0700
commit795c8996c18f5e8ef5986581644374d0c5068772 (patch)
tree3990ca2601d59e817a0766a0151b77259e2aa6b8
parent36ef90d6de0e97812bebb303a7fa5215ae4c6ebe (diff)
distribute rebalance: preserve proper mode in destinationv3.3.0qa13
* don't set 'sticky' and 'sgid' bits to 0 without checking if the source had those bits prior to rebalance. Change-Id: Ia826cb3cfb55312cdbf00d3421f2bd06b3103ce6 BUG: 3656 Reviewed-on: http://review.gluster.com/541 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index edb5c8cdcdd..71fd7b36777 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -375,6 +375,7 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
struct iatt new_stbuf = {0,};
struct iatt stbuf = {0,};
struct iatt empty_iatt = {0,};
+ ia_prot_t src_ia_prot = {0,};
fd_t *src_fd = NULL;
fd_t *dst_fd = NULL;
dict_t *dict = NULL;
@@ -403,6 +404,9 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
goto out;
}
+ /* preserve source mode, so set the same to the destination */
+ src_ia_prot = stbuf.ia_prot;
+
/* Check if file can be migrated */
ret = __is_file_migratable (this, loc, rsp_dict, &stbuf);
if (ret)
@@ -490,9 +494,13 @@ dht_migrate_file (xlator_t *this, loc_t *loc, xlator_t *from, xlator_t *to,
}
/* source would have both sticky bit and sgid bit set, reset it to 0,
- and set the source permission on destination */
- new_stbuf.ia_prot.sticky = 0;
- new_stbuf.ia_prot.sgid = 0;
+ and set the source permission on destination, if it was not set
+ prior to setting rebalance-modes in source */
+ if (!src_ia_prot.sticky)
+ new_stbuf.ia_prot.sticky = 0;
+
+ if (!src_ia_prot.sgid)
+ new_stbuf.ia_prot.sgid = 0;
/* TODO: if the source actually had sticky bit, or sgid bit set,
we are not handling it */