diff options
author | Ralph Boehme <slow@samba.org> | 2019-01-07 18:35:27 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2019-01-11 23:11:13 +0100 |
commit | e94cd84bbf87ee42495286d6ab9712ba35eaf23d (patch) | |
tree | b843642afd795bce36a0cf4967a6f8acceef4086 /lib/pthreadpool/pthreadpool.c | |
parent | 67015e13ca24a23d66ef4e465672288ba59fb889 (diff) | |
download | samba-e94cd84bbf87ee42495286d6ab9712ba35eaf23d.tar.gz |
Revert "pthreadpool: call unshare(CLONE_FS) if available"
This reverts commit 65e4742d168454df6507d9e74993749063435dd6.
See the discussion in
https://lists.samba.org/archive/samba-technical/2018-December/131731.html
for the reasoning behind this revert.
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'lib/pthreadpool/pthreadpool.c')
-rw-r--r-- | lib/pthreadpool/pthreadpool.c | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/pthreadpool/pthreadpool.c b/lib/pthreadpool/pthreadpool.c index c2bafd52c08..b6dad310b0d 100644 --- a/lib/pthreadpool/pthreadpool.c +++ b/lib/pthreadpool/pthreadpool.c @@ -113,13 +113,10 @@ struct pthreadpool { * where the forking thread will unlock it again. */ pthread_mutex_t fork_mutex; - - bool per_thread_cwd; }; static pthread_mutex_t pthreadpools_mutex = PTHREAD_MUTEX_INITIALIZER; static struct pthreadpool *pthreadpools = NULL; -static bool pthreadpool_support_thread_cwd = false; static pthread_once_t pthreadpool_atfork_initialized = PTHREAD_ONCE_INIT; static void pthreadpool_prep_atfork(void); @@ -186,11 +183,6 @@ int pthreadpool_init(unsigned max_threads, struct pthreadpool **presult, pool->max_threads = max_threads; pool->num_idle = 0; pool->prefork_cond = NULL; - if (max_threads != 0) { - pool->per_thread_cwd = pthreadpool_support_thread_cwd; - } else { - pool->per_thread_cwd = false; - } ret = pthread_mutex_lock(&pthreadpools_mutex); if (ret != 0) { @@ -250,15 +242,6 @@ size_t pthreadpool_queued_jobs(struct pthreadpool *pool) return ret; } -bool pthreadpool_per_thread_cwd(struct pthreadpool *pool) -{ - if (pool->stopped) { - return false; - } - - return pool->per_thread_cwd; -} - static void pthreadpool_prepare_pool(struct pthreadpool *pool) { int ret; @@ -377,16 +360,6 @@ static void pthreadpool_child(void) static void pthreadpool_prep_atfork(void) { -#ifdef HAVE_UNSHARE_CLONE_FS - int res; - - /* remember if unshare(CLONE_FS) works. */ - res = unshare(CLONE_FS); - if (res == 0) { - pthreadpool_support_thread_cwd = true; - } -#endif - pthread_atfork(pthreadpool_prepare, pthreadpool_parent, pthreadpool_child); } @@ -599,13 +572,6 @@ static void *pthreadpool_server(void *arg) struct pthreadpool *pool = (struct pthreadpool *)arg; int res; -#ifdef HAVE_UNSHARE_CLONE_FS - if (pool->per_thread_cwd) { - res = unshare(CLONE_FS); - assert(res == 0); - } -#endif - res = pthread_mutex_lock(&pool->mutex); if (res != 0) { return NULL; |