diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2020-02-04 14:43:35 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2020-02-05 12:13:05 +0000 |
commit | 4e9fc11b0659957e76565f6557ad1079c51d6832 (patch) | |
tree | a1badb7d8684c30a54b8c3619a7790ba019a0fac /xlators | |
parent | 2b35572e1f30c37bbbbec8f63060ae2eeaf61b32 (diff) |
protocol/client: Maintain connection to brick status
Problem:
The current version of the code depends on the non-zero-port information to
propagate ping event from brick to parent layers. But as and when connection
succeeds, port is set to zero in rpc layer.So ping event is never propagated to
parent layers. Halo doesn't work without this.
Fix:
Remember the status of connection in 'private' structure and use that to decide
to propagate ping event to parent xlator.
fixes: bz#1797934
Change-Id: Ia578ba9fb3813953d2068dbba5c982ab27cc3429
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/protocol/client/src/client.c | 10 | ||||
-rw-r--r-- | xlators/protocol/client/src/client.h | 2 |
2 files changed, 5 insertions, 7 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c index 36bf9968b64..0f31fea9511 100644 --- a/xlators/protocol/client/src/client.c +++ b/xlators/protocol/client/src/client.c @@ -2172,12 +2172,6 @@ client_mark_fd_bad(xlator_t *this) pthread_spin_unlock(&conf->fd_lock); } -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) @@ -2198,7 +2192,7 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, switch (event) { case RPC_CLNT_PING: { - if (is_connection_to_brick(rpc)) { + if (conf->connection_to_brick) { ret = default_notify(this, GF_EVENT_CHILD_PING, data); if (ret) gf_log(this->name, GF_LOG_INFO, "CHILD_PING notify failed"); @@ -2282,11 +2276,13 @@ client_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, conf->skip_notify = 0; if (conf->quick_reconnect) { + conf->connection_to_brick = _gf_true; conf->quick_reconnect = 0; rpc_clnt_cleanup_and_start(rpc); } else { rpc->conn.config.remote_port = 0; + conf->connection_to_brick = _gf_false; } break; case RPC_CLNT_DESTROY: diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h index 1f05fba444e..3b47d1207bc 100644 --- a/xlators/protocol/client/src/client.h +++ b/xlators/protocol/client/src/client.h @@ -159,6 +159,8 @@ typedef struct clnt_conf { locks when a client disconnects. */ + gf_boolean_t connection_to_brick; /*True from attempt to connect to brick + till disconnection to brick*/ } clnt_conf_t; typedef struct _client_fd_ctx { |