mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-18 21:15:58 +00:00
BUG/MINOR: server/cli: Fix locking in function processing "set server" command
The commit c7b391aed
("BUG/MEDIUM: server/cli: Fix ABBA deadlock when fqdn
is set from the CLI") introduced 2 bugs. The first one is a typo on the
server's lock label (s/SERVER_UNLOCK/SERVER_LOCK/). The second one is about
the server's lock itself. It must be acquired to execute the "agent-send"
subcommand.
The patch above is marked to be backported as far as 1.8. Thus, this one
must also backported as far 1.8.
BUG/MINOR: server/cli: Don't forget to lock server on agent-send subcommand
This commit is contained in:
parent
e886dd5c32
commit
0ba54bb401
@ -3994,12 +3994,14 @@ static int cli_parse_set_server(char **args, char *payload, struct appctx *appct
|
||||
cli_msg(appctx, LOG_WARNING, warning);
|
||||
}
|
||||
else if (strcmp(args[3], "agent-send") == 0) {
|
||||
HA_SPIN_LOCK(SERVER_LOCK, &sv->lock);
|
||||
if (!(sv->agent.state & CHK_ST_ENABLED))
|
||||
cli_err(appctx, "agent checks are not enabled on this server.\n");
|
||||
else {
|
||||
if (!set_srv_agent_send(sv, args[4]))
|
||||
cli_err(appctx, "cannot allocate memory for new string.\n");
|
||||
}
|
||||
HA_SPIN_UNLOCK(SERVER_LOCK, &sv->lock);
|
||||
}
|
||||
else if (strcmp(args[3], "check-addr") == 0) {
|
||||
char *addr = NULL;
|
||||
@ -4072,7 +4074,7 @@ static int cli_parse_set_server(char **args, char *payload, struct appctx *appct
|
||||
sv->flags &= ~SRV_F_NO_RESOLUTION;
|
||||
}
|
||||
warning = srv_update_fqdn(sv, args[4], "stats socket command", 1);
|
||||
HA_SPIN_UNLOCK(SERVER_UNLOCK, &sv->lock);
|
||||
HA_SPIN_UNLOCK(SERVER_LOCK, &sv->lock);
|
||||
HA_SPIN_UNLOCK(DNS_LOCK, &sv->resolvers->lock);
|
||||
if (warning)
|
||||
cli_msg(appctx, LOG_WARNING, warning);
|
||||
|
Loading…
Reference in New Issue
Block a user