summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2010-09-28 09:27:23 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-28 09:05:00 -0700
commitd7e694ad7049cd819f8dbc26ec1e7d35b4d1a6fe (patch)
tree02509aa7777d19b55cfb5fa155df25c0efa0979a
parent84952d98750165f211d632940fbbd95059553dc2 (diff)
mgmt/glusterd: prevent cleanup_and_exit if its already started
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1706 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1706
-rw-r--r--glusterfsd/src/glusterfsd.c8
-rw-r--r--libglusterfs/src/glusterfs.h1
2 files changed, 8 insertions, 1 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index f1cd02707..332f8f3a7 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -654,9 +654,15 @@ cleanup_and_exit (int signum)
ctx = glusterfs_ctx_get ();
/* TODO: is this the right place? */
+ if (!ctx)
+ return;
+ if (ctx->cleanup_started)
+ return;
+
+ ctx->cleanup_started = 1;
glusterfs_mgmt_pmap_signout (ctx);
- if (ctx && ctx->mgmt)
+ if (ctx->mgmt)
rpc_clnt_destroy (ctx->mgmt);
gf_log ("glusterfsd", GF_LOG_NORMAL, "shutting down");
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index f484520a7..f107a8abf 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -283,6 +283,7 @@ struct _glusterfs_ctx {
unsigned char measure_latency; /* toggle switch for latency measurement */
pthread_t sigwaiter;
struct mem_pool *stub_mem_pool;
+ unsigned char cleanup_started;
};
typedef struct _glusterfs_ctx glusterfs_ctx_t;