From: Willy Tarreau Date: Sun, 5 Nov 2017 09:59:12 +0000 (+0100) Subject: BUG/MAJOR: threads/lb: fix missing unlock on map-based hash LB X-Git-Tag: v1.8-rc3~62 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=03071f69377f94fbe69f6ca00f10f4313432edf1;p=thirdparty%2Fhaproxy.git BUG/MAJOR: threads/lb: fix missing unlock on map-based hash LB We often left the function with the lock held on success. --- diff --git a/src/lb_map.c b/src/lb_map.c index 028e85ba0b..df0e185181 100644 --- a/src/lb_map.c +++ b/src/lb_map.c @@ -224,13 +224,13 @@ struct server *map_get_server_rr(struct proxy *px, struct server *srvtoavoid) srv = px->lbprm.map.srv[newidx++]; if (!srv->maxconn || (!srv->nbpend && srv->served < srv_dynamic_maxconn(srv))) { /* make sure it is not the server we are try to exclude... */ + /* ...but remember that is was selected yet avoided */ + avoided = srv; + avoididx = newidx; if (srv != srvtoavoid) { px->lbprm.map.rr_idx = newidx; - return srv; + goto out; } - - avoided = srv; /* ...but remember that is was selected yet avoided */ - avoididx = newidx; } if (newidx == px->lbprm.tot_weight) newidx = 0;