summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-common.c47
-rw-r--r--xlators/cluster/dht/src/dht-rebalance.c9
2 files changed, 31 insertions, 25 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index f83ff6487a2..f5de8e6a6ad 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2661,6 +2661,9 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
int ret = 0;
char *uuid_str = NULL;
+ char *uuid_list = NULL;
+ char *next_uuid_str = NULL;
+ char *saveptr = NULL;
uuid_t node_uuid = {0,};
@@ -2683,7 +2686,7 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto unlock;
}
- ret = dict_get_str (xattr, local->xsel, &uuid_str);
+ ret = dict_get_str (xattr, local->xsel, &uuid_list);
if (ret < 0) {
gf_msg (this->name, GF_LOG_ERROR, 0,
@@ -2694,24 +2697,32 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto unlock;
}
- if (gf_uuid_parse (uuid_str, node_uuid)) {
- gf_msg (this->name, GF_LOG_ERROR, 0,
- DHT_MSG_UUID_PARSE_ERROR,
- "Failed to parse uuid"
- " failed for %s", prev->this->name);
- local->op_ret = -1;
- local->op_errno = EINVAL;
- goto unlock;
- }
+ for (uuid_str = strtok_r (uuid_list, " ", &saveptr);
+ uuid_str;
+ uuid_str = next_uuid_str) {
- if (gf_uuid_compare (node_uuid, conf->defrag->node_uuid)) {
- gf_msg_debug (this->name, 0, "subvol %s does not"
- "belong to this node", prev->this->name);
- } else {
- conf->local_subvols[(conf->local_subvols_cnt)++]
- = prev->this;
- gf_msg_debug (this->name, 0, "subvol %s belongs to"
- " this node", prev->this->name);
+ next_uuid_str = strtok_r (NULL, " ", &saveptr);
+ if (gf_uuid_parse (uuid_str, node_uuid)) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_UUID_PARSE_ERROR,
+ "Failed to parse uuid"
+ " failed for %s", prev->this->name);
+ local->op_ret = -1;
+ local->op_errno = EINVAL;
+ goto unlock;
+ }
+
+ if (gf_uuid_compare (node_uuid, conf->defrag->node_uuid)) {
+ gf_msg_debug (this->name, 0, "subvol %s does not"
+ "belong to this node",
+ prev->this->name);
+ } else {
+ conf->local_subvols[(conf->local_subvols_cnt)++]
+ = prev->this;
+ gf_msg_debug (this->name, 0, "subvol %s belongs to"
+ " this node", prev->this->name);
+ break;
+ }
}
}
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
index d38aeccf885..8cbfca07d96 100644
--- a/xlators/cluster/dht/src/dht-rebalance.c
+++ b/xlators/cluster/dht/src/dht-rebalance.c
@@ -2743,8 +2743,7 @@ gf_defrag_start_crawl (void *data)
goto out;
}
- if ((defrag->cmd != GF_DEFRAG_CMD_START_TIER) &&
- (defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX)) {
+ if (defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX) {
migrate_data = dict_new ();
if (!migrate_data) {
defrag->total_failures++;
@@ -2841,11 +2840,7 @@ gf_defrag_start_crawl (void *data)
}
methods->migration_other(this, defrag);
if (defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) {
- migrate_data = dict_new ();
- if (!migrate_data) {
- ret = -1;
- goto out;
- }
+
ret = dict_set_str (migrate_data,
GF_XATTR_FILE_MIGRATE_KEY,
"force");