diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-09-24 00:49:49 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-24 01:19:01 -0700 |
commit | 881e5f243d3c56dcaf54595378beb91c45f1ded5 (patch) | |
tree | 0be1be3c8f42fe42b65a36afdb131d21dfeab0a6 /libglusterfsclient | |
parent | 7398c0a694343c15292f076dbb0ae8508004d003 (diff) |
libglusterfsclient: Clean up fini and umount code paths
This patch cleans up the umount and fini paths in preparation
to support waiting for unwind of all pending call frames.
Two misc fixes are:
1. Fix to avoid deadlock in _libgf_umount by
using _libgf_vmp_search_entry instead of
libgf_vmp_search_exact_entry since the latter tries to take a
lock already help by _libgf_umount.
2. Avoid a crash in _libgf_umount by deleting the vmp
entry from the list before it gets freed.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 279 (File written with booster results in self-heal after dd exits)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=279
Diffstat (limited to 'libglusterfsclient')
-rwxr-xr-x | libglusterfsclient/src/libglusterfsclient.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c index 651f02c0b..0f2c2dd80 100755 --- a/libglusterfsclient/src/libglusterfsclient.c +++ b/libglusterfsclient/src/libglusterfsclient.c @@ -67,7 +67,6 @@ int libgf_realpath_loc_fill (libglusterfs_client_ctx_t *ctx, char *link, loc_t *targetloc); static int first_init = 1; -static int first_fini = 1; /* The global list of virtual mount points */ struct { @@ -1712,7 +1711,7 @@ _libgf_umount (char *vmp) struct vmp_entry *entry= NULL; int ret = -1; - entry = libgf_vmp_search_exact_entry (vmp); + entry = _libgf_vmp_search_entry (vmp, LIBGF_VMP_EXACT); if (entry == NULL) { gf_log ("libglusterfsclient", GF_LOG_ERROR, "path (%s) not mounted", vmp); @@ -1727,9 +1726,9 @@ _libgf_umount (char *vmp) } ret = glusterfs_fini (entry->handle); + list_del_init (&entry->list); libgf_free_vmp_entry (entry); - list_del_init (&entry->list); vmplist.entries--; out: @@ -1801,7 +1800,7 @@ glusterfs_reset (void) memset (&vmplock, 0, sizeof (vmplock)); pthread_mutex_init (&vmplock, NULL); - first_fini = first_init = 1; + first_init = 1; } void @@ -1827,29 +1826,16 @@ glusterfs_fini (glusterfs_handle_t handle) FREE (ctx->gf_ctx.cmd_args.volume_name); FREE (ctx->gf_ctx.pool); FREE (ctx->gf_ctx.event_pool); + iobuf_pool_destroy (ctx->gf_ctx.iobuf_pool); ((gf_timer_registry_t *)ctx->gf_ctx.timer)->fin = 1; - /* inode_table_destroy (ctx->itable); */ xlator_graph_fini (ctx->gf_ctx.graph); xlator_tree_free (ctx->gf_ctx.graph); ctx->gf_ctx.graph = NULL; - - /* FREE (ctx->gf_ctx.specfile); */ - - /* TODO complete cleanup of timer */ - /*TODO - * destroy the reply thread - * destroy inode table - * FREE (ctx) - */ + pthread_cancel (ctx->reply_thread); FREE (ctx); - if (first_fini) { - ; - //gf_log_cleanup (); - } - return 0; } |