From e29863934eccf570b23dd730bcb717a312558c36 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 16 Oct 2025 11:35:55 +0200 Subject: [PATCH] WIP/MEDIUM: stktables: Use a try-lock on the updates list when removing a stksess --- src/stick_table.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/stick_table.c b/src/stick_table.c index a38a712a4..be8d3f999 100644 --- a/src/stick_table.c +++ b/src/stick_table.c @@ -138,7 +138,9 @@ int __stksess_kill(struct stktable *t, struct stksess *ts) /* ... and that we didn't leave the update list for the tree */ if (MT_LIST_INLIST(&ts->upd)) { - link = mt_list_lock_full(&ts->upd); + link = mt_list_try_lock_full(&ts->upd); + if (link.next == NULL) + goto out; if (HA_ATOMIC_LOAD(&ts->ref_cnt)) { mt_list_unlock_full(&ts->upd, link); goto out; @@ -385,7 +387,9 @@ int stktable_trash_oldest(struct stktable *t) MT_LIST_DELETE(&ts->pend_updts); if (MT_LIST_INLIST(&ts->upd)) { - link = mt_list_lock_full(&ts->upd); + link = mt_list_try_lock_full(&ts->upd); + if (link.next == NULL) + goto requeue; if (HA_ATOMIC_LOAD(&ts->ref_cnt)) { mt_list_unlock_full(&ts->upd, link); goto requeue; @@ -1001,7 +1005,9 @@ struct task *process_table_expire(struct task *task, void *context, unsigned int */ MT_LIST_DELETE(&ts->pend_updts); if (MT_LIST_INLIST(&ts->upd)) { - link = mt_list_lock_full(&ts->upd); + link = mt_list_try_lock_full(&ts->upd); + if (link.next == NULL) + goto requeue; if (HA_ATOMIC_LOAD(&ts->ref_cnt)) { mt_list_unlock_full(&ts->upd, link); goto requeue;