From: Ondřej Kuzník Date: Fri, 19 Feb 2021 08:54:45 +0000 (+0000) Subject: ITS#8747 Protect shutdown code while workers are still alive X-Git-Tag: OPENLDAP_REL_ENG_2_6_0~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cba03e49a4d1fe1d6d4605b2a9eeb5a015099a23;p=thirdparty%2Fopenldap.git ITS#8747 Protect shutdown code while workers are still alive --- diff --git a/servers/lloadd/daemon.c b/servers/lloadd/daemon.c index f60db22c67..d402dfe6b1 100644 --- a/servers/lloadd/daemon.c +++ b/servers/lloadd/daemon.c @@ -1332,10 +1332,14 @@ lloadd_daemon( struct event_base *daemon_base ) /* Mark upstream connections closing and prevent from opening new ones */ LDAP_CIRCLEQ_FOREACH ( b, &backend, b_next ) { + epoch_t epoch = epoch_join(); + checked_lock( &b->b_mutex ); b->b_numconns = b->b_numbindconns = 0; backend_reset( b, 1 ); checked_unlock( &b->b_mutex ); + + epoch_leave( epoch ); } /* Do the same for clients */