]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MEDIUM: servers: make the server deletion code run under full thread isolation
authorWilly Tarreau <w@1wt.eu>
Wed, 4 Aug 2021 12:42:37 +0000 (14:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 4 Aug 2021 12:49:36 +0000 (14:49 +0200)
commitba3ab7907aa9089ac738ff8c65f826e4a98badc0
tree229c57ab9f73dde598f2e76109af999439655fc2
parent88d1c5d3fbe36b29fb50b699ef4478d275d736ae
MEDIUM: servers: make the server deletion code run under full thread isolation

In 2.4, runtime server deletion was brought by commit e558043e1 ("MINOR:
server: implement delete server cli command"). A comment remained in the
code about a theoretical race between the thread_isolate() call and another
thread being in the process of allocating memory before accessing the
server via a reference that was grabbed before the memory allocation,
since the thread_harmless_now()/thread_harmless_end() pair around mmap()
may have the effect of allowing cli_parse_delete_server() to proceed.

Now that the full thread isolation is available, let's update the code
to rely on this. Now it is guaranteed that competing threads will either
be in the poller or queued in front of thread_isolate_full().

This may be backported to 2.4 if any report of breakage suggests the bug
really exists, in which case the two following patches will also be
needed:
  MINOR: threads: make thread_release() not wait for other ones to complete
  MEDIUM: threads: add a stronger thread_isolate_full() call
src/server.c