summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2013-10-24 17:10:22 +0530
committershishir gowda <sgowda@redhat.com>2013-11-15 14:39:42 +0530
commit4e1c76a68f2208822c503a555206f21a3da52256 (patch)
tree3c92778008cccedf80a6e87113bb3d410ec12df3
parent262d9379e1dbe909e2a622a7e1806b70d3a59591 (diff)
protocol/server: avoid rpc reply to the client only if the fop is barriered
* Now, reply submission to the client is avoided even if the fop is not barriered Change-Id: I9d503935c4d851f5dd0e8e4be0fea9c92e636ff3 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
-rw-r--r--xlators/protocol/server/src/server.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 68254cf..bea3e21 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -145,6 +145,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
server_conf_t *conf = NULL;
gf_barrier_t *barrier = NULL;
gf_barrier_payload_t *stub = NULL;
+ gf_boolean_t barriered = _gf_false;
GF_VALIDATE_OR_GOTO ("server", req, ret);
@@ -189,7 +190,7 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
iob, new_iobref);
if (stub) {
gf_barrier_enqueue (barrier, stub);
- goto ret;
+ barriered = _gf_true;
} else {
gf_log ("", GF_LOG_ERROR, "Failed to "
" barrier fop %"PRIu64,
@@ -198,6 +199,8 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
}
}
UNLOCK (&barrier->lock);
+ if (barriered == _gf_true)
+ goto ret;
}
/* Then, submit the message for transmission. */
ret = rpcsvc_submit_generic (req, &rsp, 1, payload, payloadcount,
@@ -967,6 +970,7 @@ init (xlator_t *this)
}
LOCK_INIT (&barrier->lock);
+ barrier->on = _gf_false;
GF_OPTION_INIT ("barrier-queue-length", barrier->max_size,
int64, out);
@@ -1050,8 +1054,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
va_end (ap);
switch (event) {
- /* todo: GF_EVENT_BARRIER */
- case 100:
+ case GF_EVENT_VOLUME_BARRIER_OP:
ret = dict_get_int32 (dict, "barrier", &val);
if (ret) {
gf_log (this->name, GF_LOG_ERROR,
@@ -1070,7 +1073,7 @@ notify (xlator_t *this, int32_t event, void *data, ...)
gf_log (this->name, GF_LOG_ERROR,
"Barrier stop failed");
}
- ret = dict_set_int32 (dict, "barrier-status", ret);
+ ret = dict_set_int32 (output, "barrier-status", ret);
if (ret)
gf_log (this->name, GF_LOG_ERROR,
"Failed to set barrier-status in dict");