From d8eadde7d498939c746ea8ddd9dc70a1029b4070 Mon Sep 17 00:00:00 2001 From: Xavi Hernandez Date: Tue, 5 Mar 2019 18:58:20 +0100 Subject: core: avoid dynamic TLS allocation when possible Some interdependencies between logging and memory management functions make it impossible to use the logging framework before initializing memory subsystem because they both depend on Thread Local Storage allocated through pthread_key_create() during initialization. This causes a crash when we try to log something very early in the initialization phase. To prevent this, several dynamically allocated TLS structures have been replaced by static TLS reserved at compile time using '__thread' keyword. This also reduces the number of error sources, making initialization simpler. Updates: bz#1193929 Change-Id: I8ea2e072411e30790d50084b6b7e909c7bb01d50 Signed-off-by: Xavi Hernandez --- glusterfsd/src/glusterfsd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 2482edd85ed..e85db1d3507 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -2770,8 +2770,6 @@ main(int argc, char *argv[]) }; cmd_args_t *cmd = NULL; - mem_pools_init_early(); - gf_check_and_set_mem_acct(argc, argv); ctx = glusterfs_ctx_new(); @@ -2886,7 +2884,7 @@ main(int argc, char *argv[]) * the parent, but we want to do it as soon as possible after that in * case something else depends on pool allocations. */ - mem_pools_init_late(); + mem_pools_init(); ret = gf_async_init(ctx); if (ret < 0) { -- cgit