BUG/MEDIUM: server/cli: Fix ABBA deadlock when fqdn is set from the CLI
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 15 Jun 2021 10:01:29 +0000 (12:01 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 30 Jun 2021 16:27:23 +0000 (18:27 +0200)
commit0139e0a7511581c43fb86ada8d675ac636d1b082
tree6675a5cd9097cd2ed91cbd77a699f2c0f9630ac4
parentd671e9f2a5849332f04cb5d93d3cc6a838e20af6
BUG/MEDIUM: server/cli: Fix ABBA deadlock when fqdn is set from the CLI

To perform servers resolution, the resolver's lock is first acquired then
the server's lock when necessary. However, when the fqdn is set via the CLI,
the opposite is performed. So, it is possible to experience an ABBA
deadlock.

To fix this bug, the server's lock is acquired and released for each
subcommand of "set server" with an exception when the fqdn is set. The
resolver's lock is first acquired. Of course, this means we must be sure to
have a resolver to lock.

This patch must be backported as far as 1.8.

(cherry picked from commit c7b391aed21f384ac38b9f2f98239c5f1cdd1895)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 77df12ca694b168326c29efa2580a95427ad644e)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
reg-tests/server/cli_set_fdqn.vtc
src/server.c