liburcu: Update to 0.8.6
[feed/packages.git] / net / haproxy / patches / 0010-MEDIUM-config-compute-the-exact-bind-process-before-.patch
1 From 91b00c2194b728ccd61133cca83f03de3650b674 Mon Sep 17 00:00:00 2001
2 From: Willy Tarreau <w@1wt.eu>
3 Date: Tue, 16 Sep 2014 13:41:21 +0200
4 Subject: [PATCH 10/13] MEDIUM: config: compute the exact bind-process before
5 listener's maxaccept
6
7 This is a continuation of previous patch, the listener's maxaccept is divided
8 by the number of processes, so it's best if we can swap the two blocks so that
9 the number of processes is already known when computing the maxaccept value.
10 (cherry picked from commit 419ead8eca9237f9cc2ec32630d96fde333282ee)
11 ---
12 src/cfgparse.c | 156 ++++++++++++++++++++++++++++++---------------------------
13 1 file changed, 81 insertions(+), 75 deletions(-)
14
15 diff --git a/src/cfgparse.c b/src/cfgparse.c
16 index d53f69e..f3907bf 100644
17 --- a/src/cfgparse.c
18 +++ b/src/cfgparse.c
19 @@ -6042,12 +6042,11 @@ int check_config_validity()
20 proxy = next;
21 }
22
23 - while (curproxy != NULL) {
24 + for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
25 struct switching_rule *rule;
26 struct server_rule *srule;
27 struct sticking_rule *mrule;
28 struct tcp_rule *trule;
29 - struct listener *listener;
30 unsigned int next_id;
31 int nbproc;
32
33 @@ -6115,14 +6114,6 @@ int check_config_validity()
34 }
35 }
36
37 - /* here, if bind_proc is null, it means no limit, otherwise it's explicit.
38 - * We now check how many processes the proxy will effectively run on.
39 - */
40 -
41 - nbproc = global.nbproc;
42 - if (curproxy->bind_proc)
43 - nbproc = popcount(curproxy->bind_proc & nbits(global.nbproc));
44 -
45 if (global.nbproc > 1 && curproxy->table.peers.name) {
46 Alert("Proxy '%s': peers can't be used in multi-process mode (nbproc > 1).\n",
47 curproxy->id);
48 @@ -7005,6 +6996,86 @@ out_uri_auth_compat:
49 if (curproxy->options2 & PR_O2_RDPC_PRST)
50 curproxy->be_req_ana |= AN_REQ_PRST_RDP_COOKIE;
51 }
52 + }
53 +
54 + /***********************************************************/
55 + /* At this point, target names have already been resolved. */
56 + /***********************************************************/
57 +
58 + /* Check multi-process mode compatibility */
59 +
60 + if (global.nbproc > 1 && global.stats_fe) {
61 + list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
62 + unsigned long mask;
63 +
64 + mask = nbits(global.nbproc);
65 + if (global.stats_fe->bind_proc)
66 + mask &= global.stats_fe->bind_proc;
67 +
68 + if (bind_conf->bind_proc)
69 + mask &= bind_conf->bind_proc;
70 +
71 + /* stop here if more than one process is used */
72 + if (popcount(mask) > 1)
73 + break;
74 + }
75 + if (&bind_conf->by_fe != &global.stats_fe->conf.bind) {
76 + Warning("stats socket will not work as expected in multi-process mode (nbproc > 1), you should force process binding globally using 'stats bind-process' or per socket using the 'process' attribute.\n");
77 + }
78 + }
79 +
80 + /* Make each frontend inherit bind-process from its listeners when not specified. */
81 + for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
82 + if (curproxy->bind_proc)
83 + continue;
84 +
85 + list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
86 + unsigned long mask;
87 +
88 + mask = bind_conf->bind_proc ? bind_conf->bind_proc : ~0UL;
89 + curproxy->bind_proc |= mask;
90 + }
91 +
92 + if (!curproxy->bind_proc)
93 + curproxy->bind_proc = ~0UL;
94 + }
95 +
96 + if (global.stats_fe) {
97 + list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
98 + unsigned long mask;
99 +
100 + mask = bind_conf->bind_proc ? bind_conf->bind_proc : ~0UL;
101 + global.stats_fe->bind_proc |= mask;
102 + }
103 + if (!global.stats_fe->bind_proc)
104 + global.stats_fe->bind_proc = ~0UL;
105 + }
106 +
107 + /* propagate bindings from frontends to backends */
108 + for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
109 + if (curproxy->cap & PR_CAP_FE)
110 + propagate_processes(curproxy, NULL);
111 + }
112 +
113 + /* Bind each unbound backend to all processes when not specified. */
114 + for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
115 + if (curproxy->bind_proc)
116 + continue;
117 + curproxy->bind_proc = ~0UL;
118 + }
119 +
120 + /*******************************************************/
121 + /* At this step, all proxies have a non-null bind_proc */
122 + /*******************************************************/
123 +
124 + /* perform the final checks before creating tasks */
125 +
126 + for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
127 + struct listener *listener;
128 + unsigned int next_id;
129 + int nbproc;
130 +
131 + nbproc = popcount(curproxy->bind_proc & nbits(global.nbproc));
132
133 #ifdef USE_OPENSSL
134 /* Configure SSL for each bind line.
135 @@ -7149,71 +7220,6 @@ out_uri_auth_compat:
136 curproxy->id);
137 cfgerr++;
138 }
139 -
140 - curproxy = curproxy->next;
141 - }
142 -
143 - /* Check multi-process mode compatibility */
144 - if (global.nbproc > 1 && global.stats_fe) {
145 - list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
146 - unsigned long mask;
147 -
148 - mask = nbits(global.nbproc);
149 - if (global.stats_fe->bind_proc)
150 - mask &= global.stats_fe->bind_proc;
151 -
152 - if (bind_conf->bind_proc)
153 - mask &= bind_conf->bind_proc;
154 -
155 - /* stop here if more than one process is used */
156 - if (popcount(mask) > 1)
157 - break;
158 - }
159 - if (&bind_conf->by_fe != &global.stats_fe->conf.bind) {
160 - Warning("stats socket will not work as expected in multi-process mode (nbproc > 1), you should force process binding globally using 'stats bind-process' or per socket using the 'process' attribute.\n");
161 - }
162 - }
163 -
164 - /* At this point, target names have already been resolved */
165 -
166 - /* Make each frontend inherit bind-process from its listeners when not specified. */
167 - for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
168 - if (curproxy->bind_proc)
169 - continue;
170 -
171 - list_for_each_entry(bind_conf, &curproxy->conf.bind, by_fe) {
172 - unsigned long mask;
173 -
174 - mask = bind_conf->bind_proc ? bind_conf->bind_proc : ~0UL;
175 - curproxy->bind_proc |= mask;
176 - }
177 -
178 - if (!curproxy->bind_proc)
179 - curproxy->bind_proc = ~0UL;
180 - }
181 -
182 - if (global.stats_fe) {
183 - list_for_each_entry(bind_conf, &global.stats_fe->conf.bind, by_fe) {
184 - unsigned long mask;
185 -
186 - mask = bind_conf->bind_proc ? bind_conf->bind_proc : ~0UL;
187 - global.stats_fe->bind_proc |= mask;
188 - }
189 - if (!global.stats_fe->bind_proc)
190 - global.stats_fe->bind_proc = ~0UL;
191 - }
192 -
193 - /* propagate bindings from frontends to backends */
194 - for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
195 - if (curproxy->cap & PR_CAP_FE)
196 - propagate_processes(curproxy, NULL);
197 - }
198 -
199 - /* Bind each unbound backend to all processes when not specified. */
200 - for (curproxy = proxy; curproxy; curproxy = curproxy->next) {
201 - if (curproxy->bind_proc)
202 - continue;
203 - curproxy->bind_proc = ~0UL;
204 }
205
206 /* automatically compute fullconn if not set. We must not do it in the
207 --
208 1.8.5.5
209