mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-31 07:37:54 +00:00
BUG/MINOR: server: remove srv from px list on CLI 'add server' error
If an error occured during the CLI 'add server' handler, the newly created server must be removed from the proxy list if already inserted. Currently, this can happen on the extremely rare error during server id generation if there is no id left. The removal operation is not thread-safe, it must be conducted before releasing the thread isolation. This can be backported up to 2.4. Please note that dynamic server track is not implemented in 2.4, so the release_server_track invocation must be removed for the backport to prevent a compilation error.
This commit is contained in:
parent
ba3ab7907a
commit
bd8dd841e5
19
src/server.c
19
src/server.c
@ -4589,8 +4589,23 @@ static int cli_parse_add_server(char **args, char *payload, struct appctx *appct
|
||||
return 0;
|
||||
|
||||
out:
|
||||
if (srv && srv->track)
|
||||
release_server_track(srv);
|
||||
if (srv) {
|
||||
if (srv->track)
|
||||
release_server_track(srv);
|
||||
|
||||
/* remove the server from the proxy linked list */
|
||||
if (be->srv == srv) {
|
||||
be->srv = srv->next;
|
||||
}
|
||||
else {
|
||||
struct server *prev;
|
||||
for (prev = be->srv; prev && prev->next != srv; prev = prev->next)
|
||||
;
|
||||
if (prev)
|
||||
prev->next = srv->next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
thread_release();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user