diff options
author | Shehjar Tikoo <shehjart@gluster.com> | 2009-09-24 00:49:52 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-09-24 01:19:12 -0700 |
commit | 551782dfd54cb554633de526a0c4e188776c5e78 (patch) | |
tree | ed26c211a8c11848fc34189c461f8cd54507ac18 | |
parent | d528f134094d86ec7344875160a41e0ce4ebc1b0 (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
-rw-r--r-- | booster/src/booster.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/booster/src/booster.c b/booster/src/booster.c index bf2ad76d513..feb610729b8 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 (); } |