From 82cea5108995d3ce21cd6489edd6161e9b6568aa Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 19 Aug 2010 07:22:15 +0000 Subject: Probe should not probe for existing friend Signed-off-by: shishir gowda Signed-off-by: Anand V. Avati BUG: 1331 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1331 --- cli/src/cli3_1-cops.c | 4 ++++ xlators/mgmt/glusterd/src/glusterd-handler.c | 10 +++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c index 53f714c20..1bb70689e 100644 --- a/cli/src/cli3_1-cops.c +++ b/cli/src/cli3_1-cops.c @@ -76,6 +76,10 @@ gf_cli3_1_probe_cbk (struct rpc_req *req, struct iovec *iov, case GF_PROBE_LOCALHOST: cli_out ("Probe on localhost not needed"); break; + case GF_PROBE_FRIEND: + cli_out ("Probe on host %s port %d already" + " a friend",rsp.hostname, rsp.port); + break; default: cli_out ("Probe returned with unknown errno %d", rsp.op_errno); diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c index 24743c21c..64db68fa2 100644 --- a/xlators/mgmt/glusterd/src/glusterd-handler.c +++ b/xlators/mgmt/glusterd/src/glusterd-handler.c @@ -506,7 +506,7 @@ glusterd_handle_cli_probe (rpcsvc_request_t *req) { int32_t ret = -1; gf1_cli_probe_req cli_req = {0,}; - + glusterd_peerinfo_t *peerinfo = NULL; GF_ASSERT (req); if (!gf_xdr_to_cli_probe_req (req->msg[0], &cli_req)) { @@ -524,6 +524,14 @@ glusterd_handle_cli_probe (rpcsvc_request_t *req) cli_req.hostname, cli_req.port); goto out; } + if (!(ret = glusterd_friend_find_by_hostname(cli_req.hostname, + &peerinfo))) { + gf_log ("glusterd", GF_LOG_NORMAL, "Probe host %s port %d" + "already a friend", cli_req.hostname, cli_req.port); + glusterd_xfer_cli_probe_resp (req, 0, GF_PROBE_FRIEND, + cli_req.hostname, cli_req.port); + goto out; + } ret = glusterd_probe_begin (req, cli_req.hostname, cli_req.port); out: -- cgit