diff options
author | shishir <shishirng@gluster.com> | 2011-09-19 18:23:04 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-22 04:52:47 -0700 |
commit | 3672c989f369c5b57aff8d0d01fc221804ada6eb (patch) | |
tree | ca2ff20c308cddbf3601ff940b8bda182e5fb23a /xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | |
parent | 2e61c86ba89d546c7cab522b53d6b9c7f164cd8c (diff) |
Peer probe: Handle probe of friend with multiple hostname
Currently, when a peer is probed with a different hostname already belonging
to a cluster, a duplicate entry is created with uuid to set to 0.
This leaves the peerinfo in a inconsistent state, and when a detach of
this peer is issued, the correct entry gets removed.
The fix is to identify a peer with a hostname not matching to the probed
hostname and remove the incorrect entry.
Change-Id: I2f6c02f505f4426871623a4a8b45a12996095098
BUG: 3200
Reviewed-on: http://review.gluster.com/456
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-rpc-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rpc-ops.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c index 3c7b62855..c9f414052 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-rpc-ops.c @@ -519,6 +519,29 @@ glusterd3_1_probe_cbk (struct rpc_req *req, struct iovec *iov, GF_ASSERT (0); } + if (strncasecmp (rsp.hostname, peerinfo->hostname, 1024)) { + gf_log (THIS->name, GF_LOG_INFO, "Host: %s with uuid: %s " + "already present in cluster with alias hostname: %s", + rsp.hostname, uuid_utoa (rsp.uuid), peerinfo->hostname); + + ctx = ((call_frame_t *)myframe)->local; + ((call_frame_t *)myframe)->local = NULL; + + GF_ASSERT (ctx); + + rsp.op_errno = GF_PROBE_FRIEND; + if (ctx->req) { + glusterd_xfer_cli_probe_resp (ctx->req, rsp.op_ret, + rsp.op_errno, + ctx->hostname, ctx->port); + } + + glusterd_destroy_probe_ctx (ctx); + (void) glusterd_friend_remove (NULL, rsp.hostname); + ret = rsp.op_ret; + goto out; + } + uuid_copy (peerinfo->uuid, rsp.uuid); ret = glusterd_friend_sm_new_event |