summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2015-07-01 16:54:55 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-07-02 04:14:09 -0700
commit12c854b7a28a8d764f0446d2e0133c447c2537c2 (patch)
treebcde80cdd887b08e8265dd6bf494bdda6bff8ea6 /xlators
parentab74e66f1724d5ca8cfe15bd4d91a3b7da1c62bd (diff)
protocol/server: fail setvolume if any of xlators is not initialized yet
We can only start recieving fops only when all xlators in graph are initialized. Change-Id: Id79100bab5878bb2518ed133c1118554fbb35229 BUG: 1214169 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: http://review.gluster.org/11504 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/server/src/server-handshake.c17
-rw-r--r--xlators/protocol/server/src/server.c11
-rw-r--r--xlators/protocol/server/src/server.h2
3 files changed, 30 insertions, 0 deletions
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 556b0e21e7f..4aaa933da67 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -372,6 +372,23 @@ server_setvolume (rpcsvc_request_t *req)
config_params = dict_copy_with_ref (this->options, NULL);
conf = this->private;
+ if (conf->parent_up == _gf_false) {
+ /* PARENT_UP indicates that all xlators in graph are inited
+ * successfully
+ */
+ op_ret = -1;
+ op_errno = EAGAIN;
+
+ ret = dict_set_str (reply, "ERROR",
+ "xlator graph in server is not initialised "
+ "yet. Try again later");
+ if (ret < 0)
+ gf_msg_debug (this->name, 0, "failed to set error: "
+ "xlator graph in server is not "
+ "initialised yet. Try again later");
+ goto fail;
+ }
+
buf = memdup (args.dict.dict_val, args.dict.dict_len);
if (buf == NULL) {
op_ret = -1;
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 55b30180032..b4c3c61a583 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -1186,6 +1186,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
int32_t val = 0;
dict_t *dict = NULL;
dict_t *output = NULL;
+ server_conf_t *conf = NULL;
va_list ap;
dict = data;
@@ -1206,6 +1207,16 @@ notify (xlator_t *this, int32_t event, void *data, ...)
}
break;
}
+
+ case GF_EVENT_PARENT_UP:
+ {
+ conf = this->private;
+
+ conf->parent_up = _gf_true;
+
+ /* fall through and notify the event to children */
+ }
+
default:
default_notify (this, event, data);
break;
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index dc64edd0ab2..6caf44926c9 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -66,6 +66,8 @@ struct server_conf {
int event_threads; /* # of event threads
* configured */
+
+ gf_boolean_t parent_up;
};
typedef struct server_conf server_conf_t;