]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
WIP/MEDIUM: stick-tables: Don't get update lock if session is not in the update tree
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 18 Nov 2025 14:06:51 +0000 (15:06 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 18 Nov 2025 14:08:18 +0000 (15:08 +0100)
src/stick_table.c

index 12d269068603293fce336238d11f912f91366f9d..d32b49d4921607d402e851babcac7d7afebafca8 100644 (file)
@@ -376,7 +376,7 @@ int stktable_trash_oldest(struct stktable *t)
                         * with that lock held, will grab a ref_cnt before releasing the
                         * lock. So we must take this lock as well and check the ref_cnt.
                         */
-                       if (!updt_locked) {
+                       if (!updt_locked && ts->upd.node.leaf_p) {
                                updt_locked = 1;
                                HA_RWLOCK_WRLOCK(STK_TABLE_UPDT_LOCK, &t->updt_lock);
                        }
@@ -1063,7 +1063,7 @@ struct task *process_tables_expire(struct task *task, void *context, unsigned in
                         * with that lock held, will grab a ref_cnt before releasing the
                         * lock. So we must take this lock as well and check the ref_cnt.
                         */
-                       if (!updt_locked) {
+                       if (!updt_locked && ts->upd.node.leaf_p) {
                                updt_locked = 1;
                                HA_RWLOCK_WRLOCK(STK_TABLE_UPDT_LOCK, &t->updt_lock);
                        }