diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-handler.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-handler.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index f446d2b58c5..6138b592542 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -1667,6 +1667,12 @@ glusterd_handle_friend_update (rpcsvc_request_t *req) gf_log ("", GF_LOG_INFO, "Received uuid: %s, hostname:%s", uuid_buf, hostname); + if (uuid_is_null (uuid)) { + gf_log (this->name, GF_LOG_WARNING, "Updates mustn't " + "contain peer with 'null' uuid"); + continue; + } + if (!uuid_compare (uuid, priv->uuid)) { gf_log ("", GF_LOG_INFO, "Received my uuid as Friend"); i++; @@ -2129,12 +2135,14 @@ glusterd_friend_add (const char *hoststr, int port, glusterd_peerctx_args_t *args) { int ret = 0; + xlator_t *this = NULL; glusterd_conf_t *conf = NULL; glusterd_peerctx_t *peerctx = NULL; dict_t *options = NULL; gf_boolean_t handover = _gf_false; - conf = THIS->private; + this = THIS; + conf = this->private; GF_ASSERT (conf); GF_ASSERT (hoststr); @@ -2158,11 +2166,21 @@ glusterd_friend_add (const char *hoststr, int port, if (ret) goto out; + if (!restore) { + ret = glusterd_store_peerinfo (*friend); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "Failed to store " + "peerinfo"); + + goto out; + } + } + list_add_tail (&(*friend)->uuid_list, &conf->peers); ret = glusterd_rpc_create (&(*friend)->rpc, options, glusterd_peer_rpc_notify, peerctx); if (ret) { - gf_log ("glusterd", GF_LOG_ERROR, "failed to create rpc for" + gf_log (this->name, GF_LOG_ERROR, "failed to create rpc for" " peer %s", (char*)hoststr); goto out; } @@ -2174,7 +2192,7 @@ out: *friend = NULL; } - gf_log ("glusterd", GF_LOG_INFO, "connect returned %d", ret); + gf_log (this->name, GF_LOG_INFO, "connect returned %d", ret); return ret; } @@ -2831,15 +2849,6 @@ glusterd_peer_rpc_notify (struct rpc_clnt *rpc, void *mydata, { gf_log (this->name, GF_LOG_DEBUG, "got RPC_CLNT_CONNECT"); peerinfo->connected = 1; - ret = glusterd_store_peerinfo (peerinfo); - if (ret) { - ret = -1; - gf_log (this->name, GF_LOG_ERROR, "Failed to store " - "peerinfo"); - break; - } - - list_add_tail (&peerinfo->uuid_list, &conf->peers); ret = glusterd_peer_handshake (this, rpc, peerctx); if (ret) |