]> git.ipfire.org Git - thirdparty/haproxy.git/commit
MAJOR: fd: remove pending updates upon real close
authorWilly Tarreau <w@1wt.eu>
Wed, 6 Jul 2022 14:23:41 +0000 (16:23 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 15 Jul 2022 17:43:10 +0000 (19:43 +0200)
commit2f36d902aa4dc6c1d0a53db306e0138db3d607ca
treecca6b54a205b99c4bed6d14a907a9e9ac0a5f99b
parent15c5500b6e7cb503f1feb23c38f48103444d06d4
MAJOR: fd: remove pending updates upon real close

Dealing with long-lasting updates that outlive a close() is always
going to be quite a problem, not because of the thread that will
discover such updates late, but mostly due to the shared update_list
that will have an entry on hold making it difficult to reuse it, and
requiring that the fd's tgid is changed and the update_mask reset
from a safe location.

After careful inspection, it turns out that all our pollers that support
automatic event removal upon close() do not need any extra bookkeeping,
and that poll and select that use an internal representation already
provide a poller->clo() callback that is already used to update the
local event. As such, it is already safe to reset the update mask and
to remove the event from the shared list just before the final close,
because nothing remains to be done with this FD by the poller.

Doing so considerably simplifies the handling of updates, which will
only have to be inspected by the pollers, while the writers can continue
to consider that the entries are always valid. Another benefit is that
it will be possible to reduce contention on the update_list by just
having one update_list per group (left to be done later if needed).
src/fd.c