mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-02-07 05:51:48 +00:00
BUG/MEDIUM: list: add missing store barriers when updating elements and head
Commit a8434ec14
("MINOR: lists: Implement locked variations.")
introduced locked lists which use the elements pointers as locks
for concurrent operations. Under heavy stress the lists occasionally
fail. The cause is a missing barrier at some points when updating
the list element and the head : nothing prevents the compiler (or
CPU) from updating the list head first before updating the element,
making another thread jump to a wrong location. This patch simply
adds the missing barriers before these two opeations.
This will have to be backported if the commit above is backported.
This commit is contained in:
parent
285192564d
commit
690d2ad4d2
@ -189,6 +189,7 @@ struct cond_wordlist {
|
|||||||
} \
|
} \
|
||||||
(el)->n = n; \
|
(el)->n = n; \
|
||||||
(el)->p = p; \
|
(el)->p = p; \
|
||||||
|
__ha_barrier_store(); \
|
||||||
n->p = (el); \
|
n->p = (el); \
|
||||||
__ha_barrier_store(); \
|
__ha_barrier_store(); \
|
||||||
p->n = (el); \
|
p->n = (el); \
|
||||||
@ -214,6 +215,7 @@ struct cond_wordlist {
|
|||||||
} \
|
} \
|
||||||
(el)->n = n; \
|
(el)->n = n; \
|
||||||
(el)->p = p; \
|
(el)->p = p; \
|
||||||
|
__ha_barrier_store(); \
|
||||||
n->p = (el); \
|
n->p = (el); \
|
||||||
__ha_barrier_store(); \
|
__ha_barrier_store(); \
|
||||||
p->n = (el); \
|
p->n = (el); \
|
||||||
@ -276,6 +278,7 @@ struct cond_wordlist {
|
|||||||
continue; \
|
continue; \
|
||||||
if (n == (lh)) { \
|
if (n == (lh)) { \
|
||||||
(lh)->n = lh; \
|
(lh)->n = lh; \
|
||||||
|
__ha_barrier_store(); \
|
||||||
_ret = NULL; \
|
_ret = NULL; \
|
||||||
break; \
|
break; \
|
||||||
} \
|
} \
|
||||||
@ -288,6 +291,7 @@ struct cond_wordlist {
|
|||||||
n2 = HA_ATOMIC_XCHG(&n->n, LLIST_BUSY); \
|
n2 = HA_ATOMIC_XCHG(&n->n, LLIST_BUSY); \
|
||||||
if (n2 == LLIST_BUSY) { \
|
if (n2 == LLIST_BUSY) { \
|
||||||
n->p = p; \
|
n->p = p; \
|
||||||
|
__ha_barrier_store(); \
|
||||||
(lh)->n = n; \
|
(lh)->n = n; \
|
||||||
__ha_barrier_store(); \
|
__ha_barrier_store(); \
|
||||||
continue; \
|
continue; \
|
||||||
@ -296,6 +300,7 @@ struct cond_wordlist {
|
|||||||
if (p2 == LLIST_BUSY) { \
|
if (p2 == LLIST_BUSY) { \
|
||||||
n->n = n2; \
|
n->n = n2; \
|
||||||
n->p = p; \
|
n->p = p; \
|
||||||
|
__ha_barrier_store(); \
|
||||||
(lh)->n = n; \
|
(lh)->n = n; \
|
||||||
__ha_barrier_store(); \
|
__ha_barrier_store(); \
|
||||||
continue; \
|
continue; \
|
||||||
|
Loading…
Reference in New Issue
Block a user