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