Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74631
b: refs/heads/master
c: 4ac63ad
h: refs/heads/master
i:
  74629: 66d50ac
  74627: 3ac5be6
  74623: 2df50f9
v: v3
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Dec 5, 2007
1 parent f3bea9e commit 23e1711
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a014bc8f0f0a3a0cac4fef656f101cdfb77b71eb
refs/heads/master: 4ac63ad6c52e9cdefbcb54ec4575ab12b78b49d9
27 changes: 14 additions & 13 deletions trunk/net/ipv4/ipvs/ip_vs_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,19 +183,6 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler)
/* increase the module use count */
ip_vs_use_count_inc();

/*
* Make sure that the scheduler with this name doesn't exist
* in the scheduler list.
*/
sched = ip_vs_sched_getbyname(scheduler->name);
if (sched) {
ip_vs_scheduler_put(sched);
ip_vs_use_count_dec();
IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler "
"already existed in the system\n", scheduler->name);
return -EINVAL;
}

write_lock_bh(&__ip_vs_sched_lock);

if (scheduler->n_list.next != &scheduler->n_list) {
Expand All @@ -206,6 +193,20 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler)
return -EINVAL;
}

/*
* Make sure that the scheduler with this name doesn't exist
* in the scheduler list.
*/
list_for_each_entry(sched, &ip_vs_schedulers, n_list) {
if (strcmp(scheduler->name, sched->name) == 0) {
write_unlock_bh(&__ip_vs_sched_lock);
ip_vs_use_count_dec();
IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler "
"already existed in the system\n",
scheduler->name);
return -EINVAL;
}
}
/*
* Add it into the d-linked scheduler list
*/
Expand Down

0 comments on commit 23e1711

Please sign in to comment.