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