From: Willy Tarreau Date: Thu, 24 Jun 2021 14:00:18 +0000 (+0200) Subject: BUG/MINOR: queue/debug: use the correct lock labels on the queue lock X-Git-Tag: v2.5-dev1~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47ee44fb71cf88f85bbfc0d0981b4d2798f1d3ca;p=thirdparty%2Fhaproxy.git BUG/MINOR: queue/debug: use the correct lock labels on the queue lock A dedicated queue lock was added by commit 16fbdda3c ("MEDIUM: queue: use a dedicated lock for the queues (v2)") but during its rebase, some labels were lost and left to SERVER_LOCK / PROXY_LOCK instead of QUEUE_LOCK. It's harmless but can confuse the lock debugger, so better fix it. No backport is needed. --- diff --git a/src/queue.c b/src/queue.c index b7ca163ebb..6d3aa9a12b 100644 --- a/src/queue.c +++ b/src/queue.c @@ -264,10 +264,10 @@ static int pendconn_process_next_strm(struct server *srv, struct proxy *px, int /* the lock only remains held as long as the pp is * in the proxy's queue. */ - HA_SPIN_LOCK(PROXY_LOCK, &px->queue.lock); + HA_SPIN_LOCK(QUEUE_LOCK, &px->queue.lock); pp = pendconn_first(&px->queue.head); if (!pp) - HA_SPIN_UNLOCK(PROXY_LOCK, &px->queue.lock); + HA_SPIN_UNLOCK(QUEUE_LOCK, &px->queue.lock); } if (!p && !pp) @@ -300,14 +300,14 @@ static int pendconn_process_next_strm(struct server *srv, struct proxy *px, int use_pp: /* Let's switch from the server pendconn to the proxy pendconn */ __pendconn_unlink_prx(pp); - HA_SPIN_UNLOCK(PROXY_LOCK, &px->queue.lock); + HA_SPIN_UNLOCK(QUEUE_LOCK, &px->queue.lock); _HA_ATOMIC_DEC(&px->queue.length); _HA_ATOMIC_INC(&px->queue.idx); p = pp; goto unlinked; use_p: if (pp) - HA_SPIN_UNLOCK(PROXY_LOCK, &px->queue.lock); + HA_SPIN_UNLOCK(QUEUE_LOCK, &px->queue.lock); __pendconn_unlink_srv(p); _HA_ATOMIC_DEC(&srv->queue.length); _HA_ATOMIC_INC(&srv->queue.idx); @@ -347,7 +347,7 @@ void process_srv_queue(struct server *s) * them will check the conditions again before quitting. */ while (!stop && s->served < (maxconn = srv_dynamic_maxconn(s))) { - if (HA_SPIN_TRYLOCK(SERVER_LOCK, &s->queue.lock) != 0) + if (HA_SPIN_TRYLOCK(QUEUE_LOCK, &s->queue.lock) != 0) break; while (s->served < maxconn) { @@ -357,7 +357,7 @@ void process_srv_queue(struct server *s) _HA_ATOMIC_INC(&s->served); done++; } - HA_SPIN_UNLOCK(SERVER_LOCK, &s->queue.lock); + HA_SPIN_UNLOCK(QUEUE_LOCK, &s->queue.lock); } if (done) { @@ -455,7 +455,7 @@ int pendconn_redistribute(struct server *s) if ((s->proxy->options & (PR_O_REDISP|PR_O_PERSIST)) != PR_O_REDISP) return 0; - HA_SPIN_LOCK(SERVER_LOCK, &s->queue.lock); + HA_SPIN_LOCK(QUEUE_LOCK, &s->queue.lock); for (node = eb32_first(&s->queue.head); node; node = nodeb) { nodeb = eb32_next(node); @@ -470,7 +470,7 @@ int pendconn_redistribute(struct server *s) task_wakeup(p->strm->task, TASK_WOKEN_RES); xferred++; } - HA_SPIN_UNLOCK(SERVER_LOCK, &s->queue.lock); + HA_SPIN_UNLOCK(QUEUE_LOCK, &s->queue.lock); if (xferred) { _HA_ATOMIC_SUB(&s->queue.length, xferred);