BUG: checks: fix server maintenance exit sequence

Recent commit 62c3be broke maintenance mode by fixing srv_is_usable().
Enabling a disabled server would not re-introduce it into the farm.
The reason is that in set_server_up(), the SRV_MAINTAIN flag is still
present when recounting the servers. The flag was removed late only to
adjust a log message. Keep a copy of the old flag instead and update
SRV_MAINTAIN earlier.

This fix must also be backported to 1.4 (but no release got the regression).
This commit is contained in:
Willy Tarreau 2012-03-09 17:16:09 +01:00
parent 869fc1edc2
commit 4544678490
1 changed files with 3 additions and 3 deletions

View File

@ -444,6 +444,7 @@ void set_server_up(struct server *s) {
struct server *srv;
struct chunk msg;
int xferred;
unsigned int old_state = s->state;
if (s->state & SRV_MAINTAIN) {
s->health = s->rise;
@ -461,6 +462,7 @@ void set_server_up(struct server *s) {
s->last_change = now.tv_sec;
s->state |= SRV_RUNNING;
s->state &= ~SRV_MAINTAIN;
if (s->slowstart > 0) {
s->state |= SRV_WARMINGUP;
@ -483,7 +485,7 @@ void set_server_up(struct server *s) {
chunk_init(&msg, trash, sizeof(trash));
if (s->state & SRV_MAINTAIN) {
if (old_state & SRV_MAINTAIN) {
chunk_printf(&msg,
"%sServer %s/%s is UP (leaving maintenance)", s->state & SRV_BACKUP ? "Backup " : "",
s->proxy->id, s->id);
@ -505,8 +507,6 @@ void set_server_up(struct server *s) {
if (! (srv->state & SRV_MAINTAIN))
/* Only notify tracking servers if they're not in maintenance. */
set_server_up(srv);
s->state &= ~SRV_MAINTAIN;
}
if (s->health >= s->rise)