|
|
cb8e9e |
From 6d2085143a37b6f765ce2a260f0316f24b043a80 Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Raghavendra G <rgowdapp@redhat.com>
|
|
|
cb8e9e |
Date: Wed, 1 Jul 2015 16:54:55 +0530
|
|
|
cb8e9e |
Subject: [PATCH 198/200] protocol/server: fail setvolume if any of xlators is not initialized yet
|
|
|
cb8e9e |
|
|
|
cb8e9e |
We can only start recieving fops only when all xlators in graph are
|
|
|
cb8e9e |
initialized.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
upstream-patch: http://review.gluster.org/#/c/11490/1
|
|
|
cb8e9e |
Change-Id: Id79100bab5878bb2518ed133c1118554fbb35229
|
|
|
cb8e9e |
BUG: 1235735
|
|
|
cb8e9e |
Signed-off-by: Raghavendra G <rgowdapp@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/52206
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
xlators/protocol/server/src/server-handshake.c | 17 +++++++++++++++++
|
|
|
cb8e9e |
xlators/protocol/server/src/server.c | 11 +++++++++++
|
|
|
cb8e9e |
xlators/protocol/server/src/server.h | 2 ++
|
|
|
cb8e9e |
3 files changed, 30 insertions(+), 0 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
|
|
|
cb8e9e |
index 556b0e2..4aaa933 100644
|
|
|
cb8e9e |
--- a/xlators/protocol/server/src/server-handshake.c
|
|
|
cb8e9e |
+++ b/xlators/protocol/server/src/server-handshake.c
|
|
|
cb8e9e |
@@ -372,6 +372,23 @@ server_setvolume (rpcsvc_request_t *req)
|
|
|
cb8e9e |
config_params = dict_copy_with_ref (this->options, NULL);
|
|
|
cb8e9e |
conf = this->private;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
+ if (conf->parent_up == _gf_false) {
|
|
|
cb8e9e |
+ /* PARENT_UP indicates that all xlators in graph are inited
|
|
|
cb8e9e |
+ * successfully
|
|
|
cb8e9e |
+ */
|
|
|
cb8e9e |
+ op_ret = -1;
|
|
|
cb8e9e |
+ op_errno = EAGAIN;
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ ret = dict_set_str (reply, "ERROR",
|
|
|
cb8e9e |
+ "xlator graph in server is not initialised "
|
|
|
cb8e9e |
+ "yet. Try again later");
|
|
|
cb8e9e |
+ if (ret < 0)
|
|
|
cb8e9e |
+ gf_msg_debug (this->name, 0, "failed to set error: "
|
|
|
cb8e9e |
+ "xlator graph in server is not "
|
|
|
cb8e9e |
+ "initialised yet. Try again later");
|
|
|
cb8e9e |
+ goto fail;
|
|
|
cb8e9e |
+ }
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
buf = memdup (args.dict.dict_val, args.dict.dict_len);
|
|
|
cb8e9e |
if (buf == NULL) {
|
|
|
cb8e9e |
op_ret = -1;
|
|
|
cb8e9e |
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
|
|
|
cb8e9e |
index 9e644df..9c10a50 100644
|
|
|
cb8e9e |
--- a/xlators/protocol/server/src/server.c
|
|
|
cb8e9e |
+++ b/xlators/protocol/server/src/server.c
|
|
|
cb8e9e |
@@ -1188,6 +1188,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
|
|
|
cb8e9e |
int32_t val = 0;
|
|
|
cb8e9e |
dict_t *dict = NULL;
|
|
|
cb8e9e |
dict_t *output = NULL;
|
|
|
cb8e9e |
+ server_conf_t *conf = NULL;
|
|
|
cb8e9e |
va_list ap;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
dict = data;
|
|
|
cb8e9e |
@@ -1208,6 +1209,16 @@ notify (xlator_t *this, int32_t event, void *data, ...)
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ case GF_EVENT_PARENT_UP:
|
|
|
cb8e9e |
+ {
|
|
|
cb8e9e |
+ conf = this->private;
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ conf->parent_up = _gf_true;
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ /* fall through and notify the event to children */
|
|
|
cb8e9e |
+ }
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
default:
|
|
|
cb8e9e |
default_notify (this, event, data);
|
|
|
cb8e9e |
break;
|
|
|
cb8e9e |
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
|
|
|
cb8e9e |
index dc64edd..6caf449 100644
|
|
|
cb8e9e |
--- a/xlators/protocol/server/src/server.h
|
|
|
cb8e9e |
+++ b/xlators/protocol/server/src/server.h
|
|
|
cb8e9e |
@@ -66,6 +66,8 @@ struct server_conf {
|
|
|
cb8e9e |
|
|
|
cb8e9e |
int event_threads; /* # of event threads
|
|
|
cb8e9e |
* configured */
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ gf_boolean_t parent_up;
|
|
|
cb8e9e |
};
|
|
|
cb8e9e |
typedef struct server_conf server_conf_t;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|