summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-02 06:36:49 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-02 05:56:50 -0700
commit4d14dffa00b134c1092133c90e92689f0ef82374 (patch)
treecf488d672b2f3f7287d86cda88ca733cfd11e2f4 /xlators/cluster/dht
parent419e787880bacf8f3c85880a57a52ac4e532430b (diff)
cluster/dht: fixes to handle 'fix.layout' attribute properly.
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> 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
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c13
1 files changed, 10 insertions, 3 deletions
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);