summaryrefslogtreecommitdiffstats
path: root/libglusterfsclient/src/libglusterfsclient.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-09-24 00:57:37 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-24 01:19:35 -0700
commitd2a961b3d6792864d6852590c7dba93dc28906fa (patch)
tree9f1cc3c5c6f260c0327ed390ff25cd8af6be95ce /libglusterfsclient/src/libglusterfsclient.c
parent788d174c36c29e3fcc638f2064c43f60f5521dd1 (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/src/libglusterfsclient.c')
-rwxr-xr-xlibglusterfsclient/src/libglusterfsclient.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/libglusterfsclient/src/libglusterfsclient.c b/libglusterfsclient/src/libglusterfsclient.c
index 18f7d09f6..41b9d7b6c 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 {
@@ -1711,7 +1710,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);
@@ -1726,9 +1725,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:
@@ -1800,7 +1799,7 @@ glusterfs_reset (void)
memset (&vmplock, 0, sizeof (vmplock));
pthread_mutex_init (&vmplock, NULL);
- first_fini = first_init = 1;
+ first_init = 1;
}
void
@@ -1826,29 +1825,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;
}