diff options
| author | Raghavendra G <rgowdapp@redhat.com> | 2019-06-04 19:22:45 +0530 | 
|---|---|---|
| committer | Ravishankar N <ravishankar@redhat.com> | 2019-08-09 04:45:28 +0000 | 
| commit | 988a3dcea74b30bafe4da07ac63bc0dafd20c8b5 (patch) | |
| tree | ac97da909a88cb1b6a79f6841a3786741ebe7fad | |
| parent | f571e3b7bfb243f710ebc883f1dd3bd95242f126 (diff) | |
protocol/client: propagte GF_EVENT_CHILD_PING only for connections to brick
Two reasons:
* ping responses from glusterd may not be relevant for Halo
  replication. Instead, it might be interested in only knowing whether
  the brick itself is responsive.
* When a brick is killed, propagating GF_EVENT_CHILD_PING of ping
  response from glusterd results in GF_EVENT_DISCONNECT spuriously
  propagated to parent xlators. These DISCONNECT events are from the
  connections client establishes with glusterd as part of its
  reconnect logic. Without GF_EVENT_CHILD_PING, the last event
  propagated to parent xlators would be the first DISCONNECT event
  from brick and hence subsequent DISCONNECTS to glusterd are not
  propagated as protocol/client prevents same event being propagated
  to parent xlators consecutively. propagating GF_EVENT_CHILD_PING for
  ping responses from glusterd would change the last_sent_event to
  GF_EVENT_CHILD_PING and hence protocol/client cannot prevent
  subsequent DISCONNECT events
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Fixes: bz#1739335
Change-Id: I50276680c52f05ca9e12149a3094923622d6eaef
(cherry picked from commit 5d66eafec581fb3209af74595784be8854ca40a4)
| -rw-r--r-- | xlators/protocol/client/src/client.c | 16 | 
1 files changed, 12 insertions, 4 deletions
| diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 5aa3d9418f6..aa4d760e0b1 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2266,6 +2266,12 @@ client_mark_fd_bad(xlator_t *this)      return 0;  } +static int +is_connection_to_brick(struct rpc_clnt *rpc) +{ +    return (rpc->conn.config.remote_port != 0); +} +  int  client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,                    void *data) @@ -2286,10 +2292,12 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,      switch (event) {          case RPC_CLNT_PING: { -            ret = default_notify(this, GF_EVENT_CHILD_PING, data); -            if (ret) -                gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed"); -            conf->last_sent_event = GF_EVENT_CHILD_PING; +            if (is_connection_to_brick(rpc)) { +                ret = default_notify(this, GF_EVENT_CHILD_PING, data); +                if (ret) +                    gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed"); +                conf->last_sent_event = GF_EVENT_CHILD_PING; +            }              break;          }          case RPC_CLNT_CONNECT: { | 
