summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/client/src
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2018-05-30 09:34:44 +0530
committerRaghavendra G <rgowdapp@redhat.com>2018-05-31 01:52:33 +0000
commit430e4872db43447c8a15b638760d23c188257139 (patch)
treebc99b972a35056b6aff4cc677ef675779dbcc674 /xlators/protocol/client/src
parent6d569e27c203c4d7abdd14112b1f5f6bac8c94ad (diff)
protocol/client: Don't send fops till SETVOLUME is complete
An earlier commit set conf->connected just after rpc layer sends RPC_CLNT_CONNECT event. However, success of socket level connection connection doesn't indicate brick stack is ready to receive fops, as an handshake has to be done b/w client and server after RPC_CLNT_CONNECT event. Any fop sent to brick in the window between, * protocol/client receiving RPC_CLNT_CONNECT event * protocol/client receiving a successful setvolume response can end up accessing an uninitialized brick stack. So, set conf->connected only after a successful SETVOLUME. Change-Id: I139a03d2da6b0d95a0d68391fcf54b00e749decf fixes: bz#1583937 Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/protocol/client/src')
-rw-r--r--xlators/protocol/client/src/client.c7
-rw-r--r--xlators/protocol/client/src/client.h5
2 files changed, 9 insertions, 3 deletions
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index b267321afbe..078236647ad 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -2225,7 +2225,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
}
case RPC_CLNT_CONNECT:
{
- conf->connected = 1;
+ conf->can_log_disconnect = 1;
// connect happened, send 'get_supported_versions' mop
gf_msg_debug (this->name, 0, "got RPC_CLNT_CONNECT");
@@ -2243,7 +2243,7 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
client_mark_fd_bad (this);
if (!conf->skip_notify) {
- if (conf->connected) {
+ if (conf->can_log_disconnect) {
if (!conf->disconnect_err_logged) {
gf_msg (this->name, GF_LOG_INFO, 0,
PC_MSG_CLIENT_DISCONNECTED,
@@ -2278,12 +2278,13 @@ client_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
"CHILD_DOWN notify failed");
} else {
- if (conf->connected)
+ if (conf->can_log_disconnect)
gf_msg_debug (this->name, 0,
"disconnected (skipped notify)");
}
conf->connected = 0;
+ conf->can_log_disconnect = 0;
conf->skip_notify = 0;
if (conf->quick_reconnect) {
diff --git a/xlators/protocol/client/src/client.h b/xlators/protocol/client/src/client.h
index c3c8aaec0dc..5ee480367cb 100644
--- a/xlators/protocol/client/src/client.h
+++ b/xlators/protocol/client/src/client.h
@@ -235,6 +235,11 @@ typedef struct clnt_conf {
gf_boolean_t child_up; /* Set to true, when child is up, and
* false, when child is down */
+
+ gf_boolean_t can_log_disconnect; /* socket level connection is
+ * up, disconnects can be
+ * logged
+ */
} clnt_conf_t;
typedef struct _client_fd_ctx {