From 4e9fc11b0659957e76565f6557ad1079c51d6832 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Tue, 4 Feb 2020 14:43:35 +0530 Subject: 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 --- xlators/protocol/client/src/client.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'xlators/protocol/client/src/client.c') 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: -- cgit