diff options
author | Amar Tumballi <amar@gluster.com> | 2011-06-22 23:23:06 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-23 21:31:16 -0700 |
commit | a846faead3d416d9af75106694e85a776f7d07a8 (patch) | |
tree | 6e29404ed957180ece9407562aa747ea332467f8 /xlators/mgmt/glusterd/src | |
parent | 308668c055b542724d226a3b7a835e7ea06082ed (diff) |
distribute: handle 'fix.layout' key in setxattr() instead of getxattr()
as 'fix.layout' command does changes to directory layout, its not a
'read/get' type of operation, and hence as per the symantics, it suits
setxattr() better
also fix a memory leak in getxattr(), where 'local' was allocated twice
in few cases
Signed-off-by: Amar Tumballi <amar@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3075 (the 'fix.layout' command should happen through 'setxattr', not getxattr().)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3075
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 0a072e774..7f4a53a17 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -304,7 +304,6 @@ int gf_glusterd_rebalance_fix_layout (glusterd_volinfo_t *volinfo, const char *dir) { int ret = -1; - char value[128] = {0,}; char full_path[1024] = {0,}; struct stat stbuf = {0,}; DIR *fd = NULL; @@ -332,8 +331,8 @@ gf_glusterd_rebalance_fix_layout (glusterd_volinfo_t *volinfo, const char *dir) if (S_ISDIR (stbuf.st_mode)) { /* Fix the layout of the directory */ - sys_lgetxattr (full_path, "trusted.distribute.fix.layout", - &value, 128); + sys_lsetxattr (full_path, "trusted.distribute.fix.layout", + "yes", 3, 0); volinfo->defrag->total_files += 1; @@ -366,7 +365,6 @@ glusterd_defrag_start (void *data) glusterd_defrag_info_t *defrag = NULL; int ret = -1; struct stat stbuf = {0,}; - char value[128] = {0,}; defrag = volinfo->defrag; if (!defrag) @@ -388,8 +386,8 @@ glusterd_defrag_start (void *data) } /* Fix the root ('/') first */ - sys_lgetxattr (defrag->mount, "trusted.distribute.fix.layout", - &value, 128); + sys_lsetxattr (defrag->mount, "trusted.distribute.fix.layout", + "yes", 3, 0); if ((defrag->cmd == GF_DEFRAG_CMD_START) || (defrag->cmd == GF_DEFRAG_CMD_START_LAYOUT_FIX)) { |