From 114c02e54abae9b3cbf0f84bc48132bf1535118e Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Wed, 15 May 2013 18:18:24 +0530 Subject: mgmt/glusterd: Make sure peerinfo->uuid_str is assigned Change-Id: I9e2743ab61c8baee92a1dfd376ec4bb145776176 BUG: 963524 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/5016 Reviewed-by: Krishnan Parthasarathi Tested-by: Gluster Build System --- xlators/mgmt/glusterd/src/glusterd-utils.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index c5df7b4b..ea5799ae 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -74,6 +74,18 @@ static glusterd_lock_t lock; +char* +gd_peer_uuid_str (glusterd_peerinfo_t *peerinfo) +{ + if ((peerinfo == NULL) || uuid_is_null (peerinfo->uuid)) + return NULL; + + if (peerinfo->uuid_str[0] == '\0') + uuid_utoa_r (peerinfo->uuid, peerinfo->uuid_str); + + return peerinfo->uuid_str; +} + static void md5_wrapper(const unsigned char *data, size_t len, char *md5) { @@ -6840,6 +6852,7 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) int32_t current_index = 2; int32_t value32 = 0; uint64_t value = 0; + char *peer_uuid_str = NULL; GF_ASSERT (rsp_dict); conf = THIS->private; @@ -6882,9 +6895,10 @@ glusterd_volume_rebalance_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict) /* Finding the index of the node-uuid in the peer-list */ list_for_each_entry (peerinfo, &conf->peers, uuid_list) { - if (!strcmp(peerinfo->uuid_str, node_uuid_str)){ + peer_uuid_str = gd_peer_uuid_str (peerinfo); + if (strcmp (peer_uuid_str, node_uuid_str) == 0) break; - } + current_index++; } -- cgit