From 4e1c76a68f2208822c503a555206f21a3da52256 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Thu, 24 Oct 2013 17:10:22 +0530 Subject: 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 --- xlators/protocol/server/src/server.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c index 68254cf0c..bea3e21fa 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"); -- cgit