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