summaryrefslogtreecommitdiffstats
path: root/booster
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2009-09-24 00:57:40 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-24 01:19:46 -0700
commit4ab8f717e23dda136f35c30ab103762afef6ff7a (patch)
tree70f3ce038424d70cb4a25cb3ee657699950b4250 /booster
parent56d00a6e589525d4e88c86d800ef0b9665564e80 (diff)
booster: Cleanup booster_cleanup and register for atexit
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 'booster')
-rw-r--r--booster/src/booster.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c
index bf2ad76..feb6107 100644
--- a/booster/src/booster.c
+++ b/booster/src/booster.c
@@ -1139,6 +1139,7 @@ fchown (int fd, uid_t owner, gid_t group)
#define MOUNT_TABLE_HASH_SIZE 256
+static void booster_cleanup (void);
static int
booster_init (void)
{
@@ -1183,6 +1184,7 @@ booster_init (void)
ret = booster_configure (DEFAULT_BOOSTER_CONF);
}
+ atexit (booster_cleanup);
if (ret == 0)
gf_log ("booster", GF_LOG_DEBUG, "booster is inited");
return 0;
@@ -1198,27 +1200,15 @@ err:
static void
booster_cleanup (void)
{
- /* gf_fd_fdtable_destroy (booster_fdtable);*/
- /*for (i=0; i < booster_fdtable->max_fds; i++) {
- if (booster_fdtable->fds[i]) {
- fd_t *fd = booster_fdtable->fds[i];
- free (fd);
- }
- }*/
-
- free (booster_fdtable);
- booster_fdtable = NULL;
-
- /*
- * FIXME: there may be issues during execution of fini of individual
- * xlators due to inconsistent lock states.
- */
-
- /*
- * as above FIXME says, glusterfs_umount_all indeed leads to memory
- * corruption, hence commenting out
+ /* Ideally, we should be de-initing the fd-table
+ * here but the problem is that I've seen file accesses through booster
+ * continuing while the atexit registered function is called. That means
+ * , we cannot dealloc the fd-table since then there could be a crash
+ * while trying to determine whether a given fd is for libc or for
+ * libglusterfsclient.
+ * We should be satisfied with having cleaned up glusterfs contexts.
*/
- /* glusterfs_umount_all (); */
+ glusterfs_umount_all ();
glusterfs_reset ();
}