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