Revert "BUG/MINOR: server: shut down streams under thread isolation"

This reverts commit b500e84e24fd19ccbcdf4fae5165aeb07e46bd67.

Thread isolation does not work well for this, there exists code paths
which already hold the server's lock and result in a deadlock. Let's
revert that and address it better without isolation.
This commit is contained in:
Willy Tarreau 2024-09-26 18:36:17 +02:00
parent 0c94b2efec
commit d1c398b786

View File

@ -2015,9 +2015,7 @@ static int srv_has_streams(struct server *srv)
* code in <why>, which must be one of SF_ERR_* indicating the reason for the * code in <why>, which must be one of SF_ERR_* indicating the reason for the
* shutdown. * shutdown.
* *
* Note: the function will switch to thread isolation (due to shutdown_stream() * Must be called with the server lock held.
* modifying the streams directly), and commonly called with the server's lock
* held as well though not needed anymore (this is not a bug).
*/ */
void srv_shutdown_streams(struct server *srv, int why) void srv_shutdown_streams(struct server *srv, int why)
{ {
@ -2025,14 +2023,10 @@ void srv_shutdown_streams(struct server *srv, int why)
struct mt_list back; struct mt_list back;
int thr; int thr;
thread_isolate();
for (thr = 0; thr < global.nbthread; thr++) for (thr = 0; thr < global.nbthread; thr++)
MT_LIST_FOR_EACH_ENTRY_LOCKED(stream, &srv->per_thr[thr].streams, by_srv, back) MT_LIST_FOR_EACH_ENTRY_LOCKED(stream, &srv->per_thr[thr].streams, by_srv, back)
if (stream->srv_conn == srv) if (stream->srv_conn == srv)
stream_shutdown(stream, why); stream_shutdown(stream, why);
thread_release();
} }
/* Shutdown all connections of all backup servers of a proxy. The caller must /* Shutdown all connections of all backup servers of a proxy. The caller must