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