]> git.ipfire.org Git - thirdparty/samba.git/commit
pthreadpool: Undo put_job when returning error
authorChristof Schmitt <cs@samba.org>
Tue, 28 Nov 2017 17:59:06 +0000 (10:59 -0700)
committerKarolin Seeger <kseeger@samba.org>
Wed, 13 Dec 2017 09:45:13 +0000 (10:45 +0100)
commit3fc35313f09f534e8eed770ab5f583af05c7af4c
tree0eb6584cd1e2c0ce2c1985e0d91b5eb4f82a1006
parentb51a2712c1fe770a8d98c57e57b57ea83155ca57
pthreadpool: Undo put_job when returning error

When an error is returned to the caller of pthreadpool_add_job, the job
should not be kept in the internal job array. Otherwise the caller might
free the data structure and a later worker thread would still reference
it.

When it is not possible to create a single worker thread, the system
might be out of resources or hitting a configured limit. In this case
fall back to calling the job function synchronously instead of raising
the error to the caller and possibly back to the SMB client.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13170

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 065fb5d94d25d19fc85832bb85aa9e379e8551cc)
source3/lib/pthreadpool/pthreadpool.c