From 4d14dffa00b134c1092133c90e92689f0ef82374 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Thu, 2 Sep 2010 06:36:49 +0000 Subject: cluster/dht: fixes to handle 'fix.layout' attribute properly. Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 1508 (add-brick works but files are not distributed to newly added server) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1508 --- xlators/cluster/dht/src/dht-common.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'xlators') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index b9389210b99..3b4fe36185d 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1652,6 +1652,8 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, dht_layout_t *layout = NULL; int op_errno = -1; int ret = 0; + int flag = 0; + int i = 0; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -1717,7 +1719,13 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, goto err; } if (key && (strcmp (key, GF_XATTR_FIX_LAYOUT_KEY) == 0)) { - if (layout->cnt < conf->subvolume_cnt) { + for (i = 0; i < layout->cnt; i++) { + if (layout->list[i].start == layout->list[i].stop) { + flag = 1; + break; + } + } + if ((layout->cnt < conf->subvolume_cnt) || flag) { gf_log (this->name, GF_LOG_INFO, "expanding layout of %s from %d to %d", loc->path, layout->cnt, conf->subvolume_cnt); @@ -1736,8 +1744,7 @@ dht_getxattr (call_frame_t *frame, xlator_t *this, "Out of memory"); goto err; } - local->layout = layout = dht_layout_new (this, - conf->subvolume_cnt); + local->layout = layout; dht_selfheal_new_directory (frame, dht_fix_layout_cbk, layout); -- cgit