diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-12-05 12:26:13 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-12-05 12:26:13 -0500 |
commit | 2a1292b36ba106b9b7f030d3fa130f5f634fd8f0 (patch) | |
tree | 12547c03b949e9cfa64c9760be9a73f18bb7a81a /net/ipv4/ipvs/ip_vs_sched.c | |
parent | 2cfae2739bda8fc5d934977c0ab19f6df1dd6d6c (diff) | |
parent | 621544eb8c3beaa859c75850f816dd9b056a00a3 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
[LRO]: fix lro_gen_skb() alignment
[TCP]: NAGLE_PUSH seems to be a wrong way around
[TCP]: Move prior_in_flight collect to more robust place
[TCP] FRTO: Use of existing funcs make code more obvious & robust
[IRDA]: Move ircomm_tty_line_info() under #ifdef CONFIG_PROC_FS
[ROSE]: Trivial compilation CONFIG_INET=n case
[IPVS]: Fix sched registration race when checking for name collision.
[IPVS]: Don't leak sysctl tables if the scheduler registration fails.
Diffstat (limited to 'net/ipv4/ipvs/ip_vs_sched.c')
-rw-r--r-- | net/ipv4/ipvs/ip_vs_sched.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/net/ipv4/ipvs/ip_vs_sched.c b/net/ipv4/ipvs/ip_vs_sched.c index 1602304abbf9..432235861908 100644 --- a/net/ipv4/ipvs/ip_vs_sched.c +++ b/net/ipv4/ipvs/ip_vs_sched.c | |||
@@ -183,19 +183,6 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler) | |||
183 | /* increase the module use count */ | 183 | /* increase the module use count */ |
184 | ip_vs_use_count_inc(); | 184 | ip_vs_use_count_inc(); |
185 | 185 | ||
186 | /* | ||
187 | * Make sure that the scheduler with this name doesn't exist | ||
188 | * in the scheduler list. | ||
189 | */ | ||
190 | sched = ip_vs_sched_getbyname(scheduler->name); | ||
191 | if (sched) { | ||
192 | ip_vs_scheduler_put(sched); | ||
193 | ip_vs_use_count_dec(); | ||
194 | IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler " | ||
195 | "already existed in the system\n", scheduler->name); | ||
196 | return -EINVAL; | ||
197 | } | ||
198 | |||
199 | write_lock_bh(&__ip_vs_sched_lock); | 186 | write_lock_bh(&__ip_vs_sched_lock); |
200 | 187 | ||
201 | if (scheduler->n_list.next != &scheduler->n_list) { | 188 | if (scheduler->n_list.next != &scheduler->n_list) { |
@@ -207,6 +194,20 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler) | |||
207 | } | 194 | } |
208 | 195 | ||
209 | /* | 196 | /* |
197 | * Make sure that the scheduler with this name doesn't exist | ||
198 | * in the scheduler list. | ||
199 | */ | ||
200 | list_for_each_entry(sched, &ip_vs_schedulers, n_list) { | ||
201 | if (strcmp(scheduler->name, sched->name) == 0) { | ||
202 | write_unlock_bh(&__ip_vs_sched_lock); | ||
203 | ip_vs_use_count_dec(); | ||
204 | IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler " | ||
205 | "already existed in the system\n", | ||
206 | scheduler->name); | ||
207 | return -EINVAL; | ||
208 | } | ||
209 | } | ||
210 | /* | ||
210 | * Add it into the d-linked scheduler list | 211 | * Add it into the d-linked scheduler list |
211 | */ | 212 | */ |
212 | list_add(&scheduler->n_list, &ip_vs_schedulers); | 213 | list_add(&scheduler->n_list, &ip_vs_schedulers); |