Patchwork [BUG:1756,2/4,v2] protocol/client: prevent propagation of CHILD_DOWN after pmap query

login
register
Submitter Anand Avati
Date 2010-10-12 06:51:51
Message ID <20101012065151.GA21997@dev.gluster.com>
Download mbox | patch
Permalink /patch/5459/
State Accepted
Headers show

Comments

Anand Avati - 2010-10-12 06:51:51
pmap query results in a new port to which the rpc client reconnects.
This involves disconnection of current connection to pmap which was
propagating CHILD_DOWN upwards prematurely

Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com>
---
 xlators/protocol/client/src/client-handshake.c |    1 +
 xlators/protocol/client/src/client.c           |    5 ++++-
 xlators/protocol/client/src/client.h           |    1 +
 3 files changed, 6 insertions(+), 1 deletions(-)

Patch

diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index fd9ee08..3dec490 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -782,6 +782,7 @@  out:
                 STACK_DESTROY (frame->root);
 
         if (conf) {
+                conf->skip_notify = 1;
                 rpc_transport_disconnect (conf->rpc->conn.trans);
 
                 rpc_clnt_reconnect (conf->rpc->conn.trans);
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index e2513f8..53c356c 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -1585,7 +1585,10 @@  client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
 
                 gf_log (this->name, GF_LOG_TRACE, "got RPC_CLNT_DISCONNECT");
 
-                default_notify (this, GF_EVENT_CHILD_DOWN, NULL);
+                if (!conf->skip_notify)
+                        default_notify (this, GF_EVENT_CHILD_DOWN, NULL);
+                conf->skip_notify = 0;
+
                 break;
 
         default:
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index 496e709..39dfc36 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -58,6 +58,7 @@  typedef struct clnt_conf {
         uint64_t               reopen_fd_count; /* Count of fds reopened after a
                                                    connection is established */
         gf_lock_t              rec_lock;
+        int                    skip_notify;
 } clnt_conf_t;
 
 typedef struct _client_fd_ctx {