Regarding commit #61ecf2838: There's no point taking the variables locks for sess/txn/req/res contexts since these ones always run inside the same thread anyway.
-- Miroslav Zagorac Senior Developer
>From 099ed5a7cf021d7144aff009a5baa91912375509 Mon Sep 17 00:00:00 2001 From: Miroslav Zagorac <mzago...@haproxy.com> Date: Wed, 23 Feb 2022 18:15:56 +0100 Subject: [PATCH 02/16] MINOR: opentracing: only takes the variables lock on shared entries Regarding commit #61ecf2838: There's no point taking the variables locks for sess/txn/req/res contexts since these ones always run inside the same thread anyway. --- addons/ot/src/vars.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/ot/src/vars.c b/addons/ot/src/vars.c index dd823b1a7..f8a58d68a 100644 --- a/addons/ot/src/vars.c +++ b/addons/ot/src/vars.c @@ -43,10 +43,10 @@ static void flt_ot_vars_scope_dump(struct vars *vars, const char *scope) if (vars == NULL) return; - HA_RWLOCK_RDLOCK(VARS_LOCK, &(vars->rwlock)); + vars_rdlock(vars); list_for_each_entry(var, &(vars->head), l) FLT_OT_DBG(2, "'%s.%s' -> '%.*s'", scope, var->name, (int)var->data.u.str.data, var->data.u.str.area); - HA_RWLOCK_RDUNLOCK(VARS_LOCK, &(vars->rwlock)); + vars_rdunlock(vars); } @@ -389,7 +389,7 @@ int flt_ot_vars_unset(struct stream *s, const char *scope, const char *prefix, u retval = 0; - HA_RWLOCK_WRLOCK(VARS_LOCK, &(vars->rwlock)); + vars_wrlock(vars); list_for_each_entry_safe(var, var_back, &(vars->head), l) { FLT_OT_DBG(3, "variable cmp '%s' '%s' %d", var_prefix, var->name, var_prefix_len); @@ -412,7 +412,7 @@ int flt_ot_vars_unset(struct stream *s, const char *scope, const char *prefix, u retval++; } } - HA_RWLOCK_WRUNLOCK(VARS_LOCK, &(vars->rwlock)); + vars_wrunlock(vars); FLT_OT_RETURN(retval); } @@ -501,7 +501,7 @@ struct otc_text_map *flt_ot_vars_get(struct stream *s, const char *scope, const if (rc == -1) FLT_OT_RETURN(retptr); - HA_RWLOCK_RDLOCK(VARS_LOCK, &(vars->rwlock)); + vars_rdlock(vars); list_for_each_entry(var, &(vars->head), l) { FLT_OT_DBG(3, "variable cmp '%s' '%s' %d", var_name, var->name, rc); @@ -555,7 +555,7 @@ struct otc_text_map *flt_ot_vars_get(struct stream *s, const char *scope, const } } } - HA_RWLOCK_RDUNLOCK(VARS_LOCK, &(vars->rwlock)); + vars_rdunlock(vars); ot_text_map_show(retptr); -- 2.30.2