mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 21:31:28 +02:00
When EBO was brought to pl_take_w() by plock commit 60d750d ("plock: use EBO when waiting for readers to leave in take_w() and stow()"), a mistake was made: the mask against which the current value of the lock is tested excludes the first reader like in stow(), but it must not because it was just obtained via an ldadd() which means that it doesn't count itself. The problem this causes is that if there is exactly one reader when a writer grabs the lock, the writer will not wait for it to leave before starting its operations. The solution consists in checking for any reader in the IF. However the mask passed to pl_wait_unlock_*() must still exclude the lowest bit as it's verified after a subsequent load. Kudos to Remi Tricot-Le Breton for reporting and bisecting this issue with a reproducer. No backport is needed since this was brought in 2.9-dev3 with commit 8178a5211 ("MAJOR: threads/plock: update the embedded library again"). The code is now on par with plock commit ada70fe.