BUG/MEDIUM: list: correct fix for LIST_POP_LOCKED's removal of last element
As seen with Olivier, in the end the fix in commit 285192564 ("BUG/MEDIUM:
list: fix LIST_POP_LOCKED's removal of the last pointer") is wrong,
the code there was right but the bug was triggered by another bug in
LIST_ADDQ_LOCKED() which doesn't properly update the list's head by
inserting in the wrong order.
This will have to be backported if the commit above is backported.
diff --git a/include/common/mini-clist.h b/include/common/mini-clist.h
index 3b1f599..5cf23df 100644
--- a/include/common/mini-clist.h
+++ b/include/common/mini-clist.h
@@ -216,9 +216,9 @@
(el)->n = n; \
(el)->p = p; \
__ha_barrier_store(); \
- n->p = (el); \
+ n->n = (el); \
__ha_barrier_store(); \
- p->n = (el); \
+ p->p = (el); \
__ha_barrier_store(); \
break; \
} \
@@ -299,7 +299,7 @@
__ha_barrier_store(); \
continue; \
} \
- p2 = HA_ATOMIC_XCHG(&n->p, LLIST_BUSY); \
+ p2 = HA_ATOMIC_XCHG(&n2->p, LLIST_BUSY); \
if (p2 == LLIST_BUSY) { \
n->n = n2; \
n->p = p; \