Patchwork [BUG:1442] Misleading probe message for friend

login
register
Submitter shishir gowda
Date 2010-08-27 09:27:53
Message ID <20100827092753.GA28066@dev.gluster.com>
Download mbox | patch
Permalink /patch/4336/
State Accepted
Headers show

Comments

shishir gowda - 2010-08-27 09:27:53
Progress with probe if host already is present in the list and
state is not default or request received.

To test, probe from on host, on the other host, do a probe back to
host1. This should now continue with probe for the first time. Second
probe should return already friend msg.

Signed-off-by: shishir gowda <shishirng@gluster.com>
---
 xlators/mgmt/glusterd/src/glusterd-handler.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

Patch

diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 6c99ae7..9eefd89 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -530,11 +530,15 @@  glusterd_handle_cli_probe (rpcsvc_request_t *req)
 	 }
 	 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;
+                 if ((peerinfo->state.state != GD_FRIEND_STATE_REQ_RCVD)
+                    || (peerinfo->state.state != GD_FRIEND_STATE_DEFAULT)) {
+
+		        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);