]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - net/ipv4/ipvs/ip_vs_sched.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[linux-2.6-omap-h63xx.git] / net / ipv4 / ipvs / ip_vs_sched.c
index 8bc42b76223db8555bb2edb97cfea61c24d303d3..121a32b1b756739aaafb3902e41dc1d6458ce101 100644 (file)
  */
 
 #include <linux/module.h>
-#include <linux/sched.h>
 #include <linux/spinlock.h>
 #include <linux/interrupt.h>
 #include <asm/string.h>
 #include <linux/kmod.h>
+#include <linux/sysctl.h>
 
 #include <net/ip_vs.h>
 
@@ -184,19 +184,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) {
@@ -207,6 +194,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
         */