BUG/MAJOR: pools: fix incomplete backport of lockless pool fix
authorWilly Tarreau <w@1wt.eu>
Thu, 8 Jul 2021 13:23:46 +0000 (15:23 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 8 Jul 2021 13:29:38 +0000 (15:29 +0200)
commit2c8b6f6f9cabd2ad9722bc579195a4fb6e775b3a
tree9edd394537712b2a4822bbcee4e92dbf20e832dd
parent7b663c1e009f5e97d329c180cb539f56389721eb
BUG/MAJOR: pools: fix incomplete backport of lockless pool fix

Commit bc76411e0 ("BUG/MAJOR: pools: fix possible race with free() in
the lockless variant") wasn't complete. The __pool_free() function also
needed a part of the lockless variant of the code that was in
pool_put_to_shared_cache() in 2.4. Without it, a __pool_free() during
a contented pool_alloc() may catch free_list == POOL_BUSY and copy it
into the updated free list, so that the next call to __pool_get_first()
loops forever and gets killed by the watchdog.

Sadly it requires load under contention on a non-glibc system to notice
it :-/

This fix is only for 2.3 and 2.2 since 2.2 now also contains the faulty
backport of the patch above.
include/haproxy/pool.h