]> git.ipfire.org Git - thirdparty/haproxy.git/commit
BUG/MAJOR: fd/threads, task/threads: ensure all spin locks are unlocked
authorRichard Russo <russor@whatsapp.com>
Wed, 20 Feb 2019 20:43:45 +0000 (12:43 -0800)
committerOlivier Houchard <cognet@ci0.org>
Mon, 25 Feb 2019 15:16:36 +0000 (16:16 +0100)
commitbc9d9844d542e8896289af252b5b37149db4a432
tree1f0d7c081f601db585e1eba20021da321a34cadd
parentb8e602cb1bf5c818231e24b32084634edb2c8f85
BUG/MAJOR: fd/threads, task/threads: ensure all spin locks are unlocked

Calculate if the fd or task should be locked once, before locking, and
reuse the calculation when determing when to unlock.

Fixes a race condition added in 87d54a9a for fds, and b20aa9ee for tasks,
released in 1.9-dev4. When one thread modifies thread_mask to be a single
thread for a task or fd while a second thread has locked or is waiting on a
lock for that task or fd, the second thread will not unlock it.  For FDs,
this is observable when a listener is polled by multiple threads, and is
closed while those threads have events pending.  For tasks, this seems
possible, where task_set_affinity is called, but I did not observe it.

This must be backported to 1.9.
include/proto/fd.h
include/proto/task.h
src/fd.c