mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
BUG/MEDIUM: tcp-check: Don't lock the server in tcpcheck_main
There was a deadlock in tcpcheck_main function. The server's lock was already acquired by the caller (process_chk_conn or wake_srv_chk). This patch must be backported in 1.8.
This commit is contained in:
parent
e78915a47a
commit
b61028549e
13
src/checks.c
13
src/checks.c
@ -2595,8 +2595,6 @@ static int tcpcheck_main(struct check *check)
|
|||||||
struct list *head = check->tcpcheck_rules;
|
struct list *head = check->tcpcheck_rules;
|
||||||
int retcode = 0;
|
int retcode = 0;
|
||||||
|
|
||||||
HA_SPIN_LOCK(SERVER_LOCK, &check->server->lock);
|
|
||||||
|
|
||||||
/* here, we know that the check is complete or that it failed */
|
/* here, we know that the check is complete or that it failed */
|
||||||
if (check->result != CHK_RES_UNKNOWN)
|
if (check->result != CHK_RES_UNKNOWN)
|
||||||
goto out_end_tcpcheck;
|
goto out_end_tcpcheck;
|
||||||
@ -2637,7 +2635,7 @@ static int tcpcheck_main(struct check *check)
|
|||||||
if (s->proxy->timeout.check)
|
if (s->proxy->timeout.check)
|
||||||
t->expire = tick_first(t->expire, t_con);
|
t->expire = tick_first(t->expire, t_con);
|
||||||
}
|
}
|
||||||
goto out_unlock;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special case: option tcp-check with no rule, a connect is enough */
|
/* special case: option tcp-check with no rule, a connect is enough */
|
||||||
@ -2732,7 +2730,7 @@ static int tcpcheck_main(struct check *check)
|
|||||||
chunk_appendf(&trash, " comment: '%s'", comment);
|
chunk_appendf(&trash, " comment: '%s'", comment);
|
||||||
set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.str);
|
set_server_check_status(check, HCHK_STATUS_SOCKERR, trash.str);
|
||||||
check->current_step = NULL;
|
check->current_step = NULL;
|
||||||
goto out_unlock;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (check->cs)
|
if (check->cs)
|
||||||
@ -2854,7 +2852,7 @@ static int tcpcheck_main(struct check *check)
|
|||||||
if (s->proxy->timeout.check)
|
if (s->proxy->timeout.check)
|
||||||
t->expire = tick_first(t->expire, t_con);
|
t->expire = tick_first(t->expire, t_con);
|
||||||
}
|
}
|
||||||
goto out_unlock;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* end 'connect' */
|
} /* end 'connect' */
|
||||||
@ -3059,7 +3057,7 @@ static int tcpcheck_main(struct check *check)
|
|||||||
if (&check->current_step->list != head &&
|
if (&check->current_step->list != head &&
|
||||||
check->current_step->action == TCPCHK_ACT_EXPECT)
|
check->current_step->action == TCPCHK_ACT_EXPECT)
|
||||||
__cs_want_recv(cs);
|
__cs_want_recv(cs);
|
||||||
goto out_unlock;
|
goto out;
|
||||||
|
|
||||||
out_end_tcpcheck:
|
out_end_tcpcheck:
|
||||||
/* collect possible new errors */
|
/* collect possible new errors */
|
||||||
@ -3074,8 +3072,7 @@ static int tcpcheck_main(struct check *check)
|
|||||||
|
|
||||||
__cs_stop_both(cs);
|
__cs_stop_both(cs);
|
||||||
|
|
||||||
out_unlock:
|
out:
|
||||||
HA_SPIN_UNLOCK(SERVER_LOCK, &check->server->lock);
|
|
||||||
return retcode;
|
return retcode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user