a3470f
From 267c65ef6369f9becac151b1b517e0c74a1c8e8d Mon Sep 17 00:00:00 2001
a3470f
From: Raghavendra G <rgowdapp@redhat.com>
a3470f
Date: Wed, 30 May 2018 09:34:44 +0530
a3470f
Subject: [PATCH 300/305] protocol/client: Don't send fops till SETVOLUME is
a3470f
 complete
a3470f
a3470f
An earlier commit set conf->connected just after rpc layer sends
a3470f
RPC_CLNT_CONNECT event. However, success of socket level connection
a3470f
connection doesn't indicate brick stack is ready to receive fops, as
a3470f
an handshake has to be done b/w client and server after
a3470f
RPC_CLNT_CONNECT event. Any fop sent to brick in the window between,
a3470f
* protocol/client receiving RPC_CLNT_CONNECT event
a3470f
* protocol/client receiving a successful setvolume response
a3470f
a3470f
can end up accessing an uninitialized brick stack. So, set
a3470f
conf->connected only after a successful SETVOLUME.
a3470f
a3470f
>Change-Id: I139a03d2da6b0d95a0d68391fcf54b00e749decf
a3470f
>fixes: bz#1583937
a3470f
>Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
a3470f
a3470f
upstream patch: https://review.gluster.org/20101/
a3470f
BUG: 1588408
a3470f
Change-Id: I51a15a89afd1d275a44e5f279f1a685f64f10ced
a3470f
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/140963
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
a3470f
---
a3470f
 xlators/protocol/client/src/client.c | 7 ++++---
a3470f
 xlators/protocol/client/src/client.h | 5 +++++
a3470f
 2 files changed, 9 insertions(+), 3 deletions(-)
a3470f
a3470f
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
a3470f
index 6cb5b6b..26b0907 100644
a3470f
--- a/xlators/protocol/client/src/client.c
a3470f
+++ b/xlators/protocol/client/src/client.c
a3470f
@@ -2234,7 +2234,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
a3470f
         }
a3470f
         case RPC_CLNT_CONNECT:
a3470f
         {
a3470f
-                conf->connected = 1;
a3470f
+                conf->can_log_disconnect = 1;
a3470f
                 // connect happened, send 'get_supported_versions' mop
a3470f
 
a3470f
                 gf_msg_debug (this->name, 0, "got RPC_CLNT_CONNECT");
a3470f
@@ -2274,7 +2274,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
a3470f
                         client_register_grace_timer (this, conf);
a3470f
 
a3470f
                 if (!conf->skip_notify) {
a3470f
-                        if (conf->connected) {
a3470f
+                        if (conf->can_log_disconnect) {
a3470f
                                 if (!conf->disconnect_err_logged) {
a3470f
                                         gf_msg (this->name, GF_LOG_INFO, 0,
a3470f
                                                 PC_MSG_CLIENT_DISCONNECTED,
a3470f
@@ -2309,12 +2309,13 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
a3470f
                                         "CHILD_DOWN notify failed");
a3470f
 
a3470f
                 } else {
a3470f
-                        if (conf->connected)
a3470f
+                        if (conf->can_log_disconnect)
a3470f
                                 gf_msg_debug (this->name, 0,
a3470f
                                               "disconnected (skipped notify)");
a3470f
                 }
a3470f
 
a3470f
                 conf->connected = 0;
a3470f
+                conf->can_log_disconnect = 0;
a3470f
                 conf->skip_notify = 0;
a3470f
 
a3470f
                 if (conf->quick_reconnect) {
a3470f
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
a3470f
index c025b98..7e2c03c 100644
a3470f
--- a/xlators/protocol/client/src/client.h
a3470f
+++ b/xlators/protocol/client/src/client.h
a3470f
@@ -204,6 +204,11 @@ typedef struct clnt_conf {
a3470f
 
a3470f
         gf_boolean_t           child_up; /* Set to true, when child is up, and
a3470f
                                           * false, when child is down */
a3470f
+
a3470f
+        gf_boolean_t           can_log_disconnect; /* socket level connection is
a3470f
+                                                    * up, disconnects can be
a3470f
+                                                    * logged
a3470f
+                                                    */
a3470f
 } clnt_conf_t;
a3470f
 
a3470f
 typedef struct _client_fd_ctx {
a3470f
-- 
a3470f
1.8.3.1
a3470f