74b1de
From ac216eae4775f7d95877b247937e2a4a4828b1b2 Mon Sep 17 00:00:00 2001
74b1de
From: Raghavendra G <rgowdapp@redhat.com>
74b1de
Date: Tue, 4 Jun 2019 19:22:45 +0530
74b1de
Subject: [PATCH 221/221] protocol/client: propagte GF_EVENT_CHILD_PING only
74b1de
 for connections to brick
74b1de
74b1de
Two reasons:
74b1de
* ping responses from glusterd may not be relevant for Halo
74b1de
  replication. Instead, it might be interested in only knowing whether
74b1de
  the brick itself is responsive.
74b1de
* When a brick is killed, propagating GF_EVENT_CHILD_PING of ping
74b1de
  response from glusterd results in GF_EVENT_DISCONNECT spuriously
74b1de
  propagated to parent xlators. These DISCONNECT events are from the
74b1de
  connections client establishes with glusterd as part of its
74b1de
  reconnect logic. Without GF_EVENT_CHILD_PING, the last event
74b1de
  propagated to parent xlators would be the first DISCONNECT event
74b1de
  from brick and hence subsequent DISCONNECTS to glusterd are not
74b1de
  propagated as protocol/client prevents same event being propagated
74b1de
  to parent xlators consecutively. propagating GF_EVENT_CHILD_PING for
74b1de
  ping responses from glusterd would change the last_sent_event to
74b1de
  GF_EVENT_CHILD_PING and hence protocol/client cannot prevent
74b1de
  subsequent DISCONNECT events
74b1de
74b1de
>Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
74b1de
>Fixes: bz#1716979
74b1de
>Change-Id: I50276680c52f05ca9e12149a3094923622d6eaef
74b1de
74b1de
Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/22821/
74b1de
74b1de
BUG: 1703423
74b1de
Change-Id: I50276680c52f05ca9e12149a3094923622d6eaef
74b1de
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/174883
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
---
74b1de
 xlators/protocol/client/src/client.c | 16 ++++++++++++----
74b1de
 1 file changed, 12 insertions(+), 4 deletions(-)
74b1de
74b1de
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
74b1de
index a372807..95e4be5 100644
74b1de
--- a/xlators/protocol/client/src/client.c
74b1de
+++ b/xlators/protocol/client/src/client.c
74b1de
@@ -2276,6 +2276,12 @@ client_mark_fd_bad(xlator_t *this)
74b1de
     return 0;
74b1de
 }
74b1de
 
74b1de
+static int
74b1de
+is_connection_to_brick(struct rpc_clnt *rpc)
74b1de
+{
74b1de
+    return (rpc->conn.config.remote_port != 0);
74b1de
+}
74b1de
+
74b1de
 int
74b1de
 client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
74b1de
                   void *data)
74b1de
@@ -2297,10 +2303,12 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
74b1de
 
74b1de
     switch (event) {
74b1de
         case RPC_CLNT_PING: {
74b1de
-            ret = default_notify(this, GF_EVENT_CHILD_PING, data);
74b1de
-            if (ret)
74b1de
-                gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed");
74b1de
-            conf->last_sent_event = GF_EVENT_CHILD_PING;
74b1de
+            if (is_connection_to_brick(rpc)) {
74b1de
+                ret = default_notify(this, GF_EVENT_CHILD_PING, data);
74b1de
+                if (ret)
74b1de
+                    gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed");
74b1de
+                conf->last_sent_event = GF_EVENT_CHILD_PING;
74b1de
+            }
74b1de
             break;
74b1de
         }
74b1de
         case RPC_CLNT_CONNECT: {
74b1de
-- 
74b1de
1.8.3.1
74b1de