mirror of
https://github.com/samba-team/samba.git
synced 2025-03-08 04:58:40 +03:00
pthreadpool: Signal job completion without the pool mutex
This essentially reverts 1c4284c7395f23. We now call an alien function from within pthreadpool, and we should not hold a mutex during that call. The alien function could (and pthreadpool_tevent_job_signal actually does) lock a mutex. We can't guarantee proper lock ordering here, so in theory we could deadlock. I haven't seen it in the wild yet, but I could imagine that both _parent pieces in pthreadpool and tevent could trigger such a deadlock. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Aug 30 04:06:20 CEST 2016 on sn-devel-144
This commit is contained in:
parent
e7e18c432d
commit
9395d958d6
@ -491,12 +491,13 @@ static void *pthreadpool_server(void *arg)
|
||||
|
||||
job.fn(job.private_data);
|
||||
|
||||
res = pthread_mutex_lock(&pool->mutex);
|
||||
assert(res == 0);
|
||||
|
||||
ret = pool->signal_fn(job.id,
|
||||
job.fn, job.private_data,
|
||||
pool->signal_fn_private_data);
|
||||
|
||||
res = pthread_mutex_lock(&pool->mutex);
|
||||
assert(res == 0);
|
||||
|
||||
if (ret != 0) {
|
||||
pthreadpool_server_exit(pool);
|
||||
pthread_mutex_unlock(&pool->mutex);
|
||||
|
Loading…
x
Reference in New Issue
Block a user