From 2347a1a7594dafc1e6a74784287efe84963fe4ea Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Wed, 28 Aug 2013 18:38:26 -0700 Subject: parser: make the parser thread safe. The volfile parser thread safe by guarding the parsing phase in a mutex. Thread safety becomes a problem when there are multiple glfs_t objects created by gfapi and all of them potentially parse the respective volfiles at the same time. Change-Id: I4376019c4956994b72397ab36e6ac3ce849797ec BUG: 1004519 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.org/5790 Reviewed-by: Raghavendra G Reviewed-by: Raghavendra Bhat Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/graph.y | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'libglusterfs/src') diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y index e2f16ff714b..282cee3817c 100644 --- a/libglusterfs/src/graph.y +++ b/libglusterfs/src/graph.y @@ -18,6 +18,7 @@ #include #include #include +#include #define RELAX_POISONING @@ -557,6 +558,7 @@ glusterfs_graph_construct (FILE *fp) glusterfs_graph_t *graph = NULL; FILE *tmp_file = NULL; char template[PATH_MAX] = {0}; + static pthread_mutex_t graph_mutex = PTHREAD_MUTEX_INITIALIZER; graph = glusterfs_graph_new (); if (!graph) @@ -583,10 +585,14 @@ glusterfs_graph_construct (FILE *fp) goto err; } - yyin = tmp_file; - construct = graph; - ret = yyparse (); - construct = NULL; + pthread_mutex_lock (&graph_mutex); + { + yyin = tmp_file; + construct = graph; + ret = yyparse (); + construct = NULL; + } + pthread_mutex_unlock (&graph_mutex); if (ret == 1) { gf_log ("parser", GF_LOG_DEBUG, -- cgit ='release-6'>release-6
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawa@redhat.com>2018-02-18 08:14:35 +0530
committerAmar Tumballi <amarts@redhat.com>2018-02-19 19:30:56 +0000
commite3e7cdbde5463ff6d20af52329a784ca629c6aef (patch)
tree43887efd6a9c624ac204ad6bba6065baba2ab1cf /xlators/features/quota
parent8d9961e63786cf8a9bb9e2f4140ab9a77f1ccbe3 (diff)
Revert "glusterfsd: Memleak in glusterfsd process while brick mux is on"
There are still remain some code paths where cleanup is required while brick mux is on.I will upload a new patch after resolve all code paths. This reverts commit b313d97faa766443a7f8128b6e19f3d2f1b267dd. BUG: 1544090 Change-Id: I26ef1d29061092bd9a409c8933d5488e968ed90e Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
Diffstat (limited to 'xlators/features/quota')
-rw-r--r--