From 8e4d735b67c78f10fd752f2b48981843595e67b5 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 30 Aug 2010 01:44:00 +0000 Subject: glusterfsd: call fini of fuse and all active xlators in cleanup_and_exit() * handles the case of stale mount point in case of killing glusterfs process Signed-off-by: Amar Tumballi Signed-off-by: Vijay Bellur BUG: 1030 (mount directory is not unmounted after killing glusterfs process) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1030 --- glusterfsd/src/glusterfsd.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 2a542f63c60..0717e313100 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -637,8 +637,9 @@ parse_opts (int key, char *arg, struct argp_state *state) static void cleanup_and_exit (int signum) { - glusterfs_ctx_t *ctx = NULL; + glusterfs_ctx_t *ctx = NULL; call_pool_t *tmp_pool = NULL; + xlator_t *trav = NULL; ctx = glusterfs_ctx_get (); @@ -653,6 +654,21 @@ cleanup_and_exit (int signum) tmp_pool = NULL; mem_pool_destroy (ctx->stub_mem_pool); + /* Call fini() of FUSE xlator first */ + trav = ctx->master; + if (trav && trav->fini) + trav->fini (trav); + + /* call fini() of each xlator */ + trav = NULL; + if (ctx->active) + trav = ctx->active->top; + while (trav) { + if (trav->fini) + trav->fini (trav); + trav = trav->next; + } + glusterfs_pidfile_cleanup (ctx); exit (0); -- cgit