summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorshishir gowda <sgowda@redhat.com>2013-11-18 09:25:24 +0530
committerGerrit Code Review <review@dev.gluster.org>2013-11-18 20:24:03 -0800
commita9af293525e8f8dae4ecfb0048fbb60c45dd3a62 (patch)
tree6a6af002a4d33e1436f958e9f02a81e8e0247690
parent5af3c6e4b3d88690bf1d812534488fcc97625efa (diff)
protocol/server: Unbarrier in a thread.
Currently if the queue length is large, the response to glusterd will get blocked Change-Id: I713e8803a087b5131a35050ca027165562d7e1b7 Signed-off-by: shishir gowda <sgowda@redhat.com>
-rw-r--r--xlators/protocol/server/src/server-helpers.c15
-rw-r--r--xlators/protocol/server/src/server.h1
2 files changed, 12 insertions, 4 deletions
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 2df463a..12951a7 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -1017,7 +1017,7 @@ gf_barrier_dequeue (gf_barrier_t *barrier)
}
-void
+void*
gf_barrier_dequeue_start (void *data)
{
server_conf_t *conf = NULL;
@@ -1026,7 +1026,7 @@ gf_barrier_dequeue_start (void *data)
conf = (server_conf_t *)data;
if (!conf || !conf->barrier)
- return;
+ return NULL;
barrier = conf->barrier;
LOCK (&barrier->lock);
@@ -1043,7 +1043,7 @@ gf_barrier_dequeue_start (void *data)
}
}
UNLOCK (&barrier->lock);
- return;
+ return NULL;
}
void
@@ -1149,7 +1149,14 @@ gf_barrier_stop (xlator_t *this)
if (need_dequeue == _gf_true) {
gf_timer_call_cancel (this->ctx, barrier->timer);
- gf_barrier_dequeue_start (conf);
+ ret = gf_thread_create (&conf->barrier_th, NULL,
+ gf_barrier_dequeue_start,
+ conf);
+ if (ret) {
+ gf_log (this->name, GF_LOG_CRITICAL,
+ "Failed to start un-barriering");
+ goto out;
+ }
}
ret = 0;
out:
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index e763909..82554ae 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -86,6 +86,7 @@ struct server_conf {
pthread_mutex_t mutex;
gf_barrier_t *barrier;
struct list_head xprt_list;
+ pthread_t barrier_th;
};
typedef struct server_conf server_conf_t;