]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: list: fix again LIST_ADDQ_LOCKED
authorWilly Tarreau <w@1wt.eu>
Mon, 4 Mar 2019 10:19:49 +0000 (11:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 4 Mar 2019 13:09:22 +0000 (14:09 +0100)
Well, that's becoming embarrassing. Now this fixes commit 4ef6801c
("BUG/MEDIUM: list: correct fix for LIST_POP_LOCKED's removal of last
element") which itself tried to fix commit 285192564. This fix only
works under low contention and was tested with the listener's queue.
With the idle conns it's obvious that it's still wrong since adding
more than one element to the list leaves a LLIST_BUSY pointer into
the list's head. This was visible when accumulating idle connections
in a server's list.

This new version of the fix almost goes back to the original code,
except that since then we addressed issues with expectedly idempotent
operations that were not. Now the code has been verified on paper again
and has survived 300 million connections spread over 4 threads.

This will have to be backported if the commit above is backported.

include/common/mini-clist.h

index 5cf23df1ba7c8b32844014e3b512b7b8e27f9731..23c1600db29b1b2dfca8816b818f49a765d437f9 100644 (file)
@@ -216,9 +216,9 @@ struct cond_wordlist {
                        (el)->n = n;                                       \
                        (el)->p = p;                                       \
                        __ha_barrier_store();                              \
-                       n->n = (el);                                       \
+                       p->n = (el);                                       \
                        __ha_barrier_store();                              \
-                       p->p = (el);                                       \
+                       n->p = (el);                                       \
                        __ha_barrier_store();                              \
                        break;                                             \
                }                                                          \