Commit 0a37c10e authored by David S. Miller's avatar David S. Miller

Merge branch 'stealer/ipvs/for-davem' of git://git.stealer.net/linux-2.6

parents 37cc6780 e93615d0
...@@ -140,8 +140,24 @@ struct ip_vs_seq { ...@@ -140,8 +140,24 @@ struct ip_vs_seq {
/* /*
* IPVS statistics object * IPVS statistics objects
*/ */
struct ip_vs_estimator {
struct list_head list;
u64 last_inbytes;
u64 last_outbytes;
u32 last_conns;
u32 last_inpkts;
u32 last_outpkts;
u32 cps;
u32 inpps;
u32 outpps;
u32 inbps;
u32 outbps;
};
struct ip_vs_stats struct ip_vs_stats
{ {
__u32 conns; /* connections scheduled */ __u32 conns; /* connections scheduled */
...@@ -156,7 +172,15 @@ struct ip_vs_stats ...@@ -156,7 +172,15 @@ struct ip_vs_stats
__u32 inbps; /* current in byte rate */ __u32 inbps; /* current in byte rate */
__u32 outbps; /* current out byte rate */ __u32 outbps; /* current out byte rate */
/*
* Don't add anything before the lock, because we use memcpy() to copy
* the members before the lock to struct ip_vs_stats_user in
* ip_vs_ctl.c.
*/
spinlock_t lock; /* spin lock */ spinlock_t lock; /* spin lock */
struct ip_vs_estimator est; /* estimator */
}; };
struct dst_entry; struct dst_entry;
...@@ -440,7 +464,7 @@ struct ip_vs_app ...@@ -440,7 +464,7 @@ struct ip_vs_app
*/ */
extern const char *ip_vs_proto_name(unsigned proto); extern const char *ip_vs_proto_name(unsigned proto);
extern void ip_vs_init_hash_table(struct list_head *table, int rows); extern void ip_vs_init_hash_table(struct list_head *table, int rows);
#define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table(t, sizeof(t)/sizeof(t[0])) #define IP_VS_INIT_HASH_TABLE(t) ip_vs_init_hash_table((t), ARRAY_SIZE((t)))
#define IP_VS_APP_TYPE_FTP 1 #define IP_VS_APP_TYPE_FTP 1
...@@ -620,7 +644,7 @@ extern int sysctl_ip_vs_expire_quiescent_template; ...@@ -620,7 +644,7 @@ extern int sysctl_ip_vs_expire_quiescent_template;
extern int sysctl_ip_vs_sync_threshold[2]; extern int sysctl_ip_vs_sync_threshold[2];
extern int sysctl_ip_vs_nat_icmp_send; extern int sysctl_ip_vs_nat_icmp_send;
extern struct ip_vs_stats ip_vs_stats; extern struct ip_vs_stats ip_vs_stats;
extern struct ctl_path net_vs_ctl_path[]; extern const struct ctl_path net_vs_ctl_path[];
extern struct ip_vs_service * extern struct ip_vs_service *
ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport); ip_vs_service_get(__u32 fwmark, __u16 protocol, __be32 vaddr, __be16 vport);
...@@ -659,7 +683,7 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp); ...@@ -659,7 +683,7 @@ extern void ip_vs_sync_conn(struct ip_vs_conn *cp);
/* /*
* IPVS rate estimator prototypes (from ip_vs_est.c) * IPVS rate estimator prototypes (from ip_vs_est.c)
*/ */
extern int ip_vs_new_estimator(struct ip_vs_stats *stats); extern void ip_vs_new_estimator(struct ip_vs_stats *stats);
extern void ip_vs_kill_estimator(struct ip_vs_stats *stats); extern void ip_vs_kill_estimator(struct ip_vs_stats *stats);
extern void ip_vs_zero_estimator(struct ip_vs_stats *stats); extern void ip_vs_zero_estimator(struct ip_vs_stats *stats);
......
...@@ -608,7 +608,7 @@ int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri, ...@@ -608,7 +608,7 @@ int ip_vs_skb_replace(struct sk_buff *skb, gfp_t pri,
} }
int ip_vs_app_init(void) int __init ip_vs_app_init(void)
{ {
/* we will replace it with proc_net_ipvs_create() soon */ /* we will replace it with proc_net_ipvs_create() soon */
proc_net_fops_create(&init_net, "ip_vs_app", 0, &ip_vs_app_fops); proc_net_fops_create(&init_net, "ip_vs_app", 0, &ip_vs_app_fops);
......
...@@ -965,7 +965,7 @@ static void ip_vs_conn_flush(void) ...@@ -965,7 +965,7 @@ static void ip_vs_conn_flush(void)
} }
int ip_vs_conn_init(void) int __init ip_vs_conn_init(void)
{ {
int idx; int idx;
......
...@@ -683,9 +683,22 @@ static void ...@@ -683,9 +683,22 @@ static void
ip_vs_zero_stats(struct ip_vs_stats *stats) ip_vs_zero_stats(struct ip_vs_stats *stats)
{ {
spin_lock_bh(&stats->lock); spin_lock_bh(&stats->lock);
memset(stats, 0, (char *)&stats->lock - (char *)stats);
spin_unlock_bh(&stats->lock); stats->conns = 0;
stats->inpkts = 0;
stats->outpkts = 0;
stats->inbytes = 0;
stats->outbytes = 0;
stats->cps = 0;
stats->inpps = 0;
stats->outpps = 0;
stats->inbps = 0;
stats->outbps = 0;
ip_vs_zero_estimator(stats); ip_vs_zero_estimator(stats);
spin_unlock_bh(&stats->lock);
} }
/* /*
...@@ -1589,7 +1602,7 @@ static struct ctl_table vs_vars[] = { ...@@ -1589,7 +1602,7 @@ static struct ctl_table vs_vars[] = {
{ .ctl_name = 0 } { .ctl_name = 0 }
}; };
struct ctl_path net_vs_ctl_path[] = { const struct ctl_path net_vs_ctl_path[] = {
{ .procname = "net", .ctl_name = CTL_NET, }, { .procname = "net", .ctl_name = CTL_NET, },
{ .procname = "ipv4", .ctl_name = NET_IPV4, }, { .procname = "ipv4", .ctl_name = NET_IPV4, },
{ .procname = "vs", }, { .procname = "vs", },
...@@ -1784,7 +1797,9 @@ static const struct file_operations ip_vs_info_fops = { ...@@ -1784,7 +1797,9 @@ static const struct file_operations ip_vs_info_fops = {
#endif #endif
struct ip_vs_stats ip_vs_stats; struct ip_vs_stats ip_vs_stats = {
.lock = __SPIN_LOCK_UNLOCKED(ip_vs_stats.lock),
};
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int ip_vs_stats_show(struct seq_file *seq, void *v) static int ip_vs_stats_show(struct seq_file *seq, void *v)
...@@ -2306,7 +2321,7 @@ static struct nf_sockopt_ops ip_vs_sockopts = { ...@@ -2306,7 +2321,7 @@ static struct nf_sockopt_ops ip_vs_sockopts = {
}; };
int ip_vs_control_init(void) int __init ip_vs_control_init(void)
{ {
int ret; int ret;
int idx; int idx;
...@@ -2333,8 +2348,6 @@ int ip_vs_control_init(void) ...@@ -2333,8 +2348,6 @@ int ip_vs_control_init(void)
INIT_LIST_HEAD(&ip_vs_rtable[idx]); INIT_LIST_HEAD(&ip_vs_rtable[idx]);
} }
memset(&ip_vs_stats, 0, sizeof(ip_vs_stats));
spin_lock_init(&ip_vs_stats.lock);
ip_vs_new_estimator(&ip_vs_stats); ip_vs_new_estimator(&ip_vs_stats);
/* Hook the defense timer */ /* Hook the defense timer */
......
...@@ -233,6 +233,7 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler = ...@@ -233,6 +233,7 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler =
.name = "dh", .name = "dh",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_dh_scheduler.n_list),
.init_service = ip_vs_dh_init_svc, .init_service = ip_vs_dh_init_svc,
.done_service = ip_vs_dh_done_svc, .done_service = ip_vs_dh_done_svc,
.update_service = ip_vs_dh_update_svc, .update_service = ip_vs_dh_update_svc,
...@@ -242,7 +243,6 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler = ...@@ -242,7 +243,6 @@ static struct ip_vs_scheduler ip_vs_dh_scheduler =
static int __init ip_vs_dh_init(void) static int __init ip_vs_dh_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_dh_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_dh_scheduler); return register_ip_vs_scheduler(&ip_vs_dh_scheduler);
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/sysctl.h> #include <linux/sysctl.h>
#include <linux/list.h>
#include <net/ip_vs.h> #include <net/ip_vs.h>
...@@ -44,28 +45,11 @@ ...@@ -44,28 +45,11 @@
*/ */
struct ip_vs_estimator static void estimation_timer(unsigned long arg);
{
struct ip_vs_estimator *next;
struct ip_vs_stats *stats;
u32 last_conns;
u32 last_inpkts;
u32 last_outpkts;
u64 last_inbytes;
u64 last_outbytes;
u32 cps;
u32 inpps;
u32 outpps;
u32 inbps;
u32 outbps;
};
static struct ip_vs_estimator *est_list = NULL; static LIST_HEAD(est_list);
static DEFINE_RWLOCK(est_lock); static DEFINE_SPINLOCK(est_lock);
static struct timer_list est_timer; static DEFINE_TIMER(est_timer, estimation_timer, 0, 0);
static void estimation_timer(unsigned long arg) static void estimation_timer(unsigned long arg)
{ {
...@@ -76,9 +60,9 @@ static void estimation_timer(unsigned long arg) ...@@ -76,9 +60,9 @@ static void estimation_timer(unsigned long arg)
u64 n_inbytes, n_outbytes; u64 n_inbytes, n_outbytes;
u32 rate; u32 rate;
read_lock(&est_lock); spin_lock(&est_lock);
for (e = est_list; e; e = e->next) { list_for_each_entry(e, &est_list, list) {
s = e->stats; s = container_of(e, struct ip_vs_stats, est);
spin_lock(&s->lock); spin_lock(&s->lock);
n_conns = s->conns; n_conns = s->conns;
...@@ -114,19 +98,16 @@ static void estimation_timer(unsigned long arg) ...@@ -114,19 +98,16 @@ static void estimation_timer(unsigned long arg)
s->outbps = (e->outbps+0xF)>>5; s->outbps = (e->outbps+0xF)>>5;
spin_unlock(&s->lock); spin_unlock(&s->lock);
} }
read_unlock(&est_lock); spin_unlock(&est_lock);
mod_timer(&est_timer, jiffies + 2*HZ); mod_timer(&est_timer, jiffies + 2*HZ);
} }
int ip_vs_new_estimator(struct ip_vs_stats *stats) void ip_vs_new_estimator(struct ip_vs_stats *stats)
{ {
struct ip_vs_estimator *est; struct ip_vs_estimator *est = &stats->est;
est = kzalloc(sizeof(*est), GFP_KERNEL); INIT_LIST_HEAD(&est->list);
if (est == NULL)
return -ENOMEM;
est->stats = stats;
est->last_conns = stats->conns; est->last_conns = stats->conns;
est->cps = stats->cps<<10; est->cps = stats->cps<<10;
...@@ -142,59 +123,40 @@ int ip_vs_new_estimator(struct ip_vs_stats *stats) ...@@ -142,59 +123,40 @@ int ip_vs_new_estimator(struct ip_vs_stats *stats)
est->last_outbytes = stats->outbytes; est->last_outbytes = stats->outbytes;
est->outbps = stats->outbps<<5; est->outbps = stats->outbps<<5;
write_lock_bh(&est_lock); spin_lock_bh(&est_lock);
est->next = est_list; if (list_empty(&est_list))
if (est->next == NULL) { mod_timer(&est_timer, jiffies + 2 * HZ);
setup_timer(&est_timer, estimation_timer, 0); list_add(&est->list, &est_list);
est_timer.expires = jiffies + 2*HZ; spin_unlock_bh(&est_lock);
add_timer(&est_timer);
}
est_list = est;
write_unlock_bh(&est_lock);
return 0;
} }
void ip_vs_kill_estimator(struct ip_vs_stats *stats) void ip_vs_kill_estimator(struct ip_vs_stats *stats)
{ {
struct ip_vs_estimator *est, **pest; struct ip_vs_estimator *est = &stats->est;
int killed = 0;
spin_lock_bh(&est_lock);
write_lock_bh(&est_lock); list_del(&est->list);
pest = &est_list; while (list_empty(&est_list) && try_to_del_timer_sync(&est_timer) < 0) {
while ((est=*pest) != NULL) { spin_unlock_bh(&est_lock);
if (est->stats != stats) { cpu_relax();
pest = &est->next; spin_lock_bh(&est_lock);
continue;
}
*pest = est->next;
kfree(est);
killed++;
} }
if (killed && est_list == NULL) spin_unlock_bh(&est_lock);
del_timer_sync(&est_timer);
write_unlock_bh(&est_lock);
} }
void ip_vs_zero_estimator(struct ip_vs_stats *stats) void ip_vs_zero_estimator(struct ip_vs_stats *stats)
{ {
struct ip_vs_estimator *e; struct ip_vs_estimator *est = &stats->est;
write_lock_bh(&est_lock); /* set counters zero, caller must hold the stats->lock lock */
for (e = est_list; e; e = e->next) { est->last_inbytes = 0;
if (e->stats != stats) est->last_outbytes = 0;
continue; est->last_conns = 0;
est->last_inpkts = 0;
/* set counters zero */ est->last_outpkts = 0;
e->last_conns = 0; est->cps = 0;
e->last_inpkts = 0; est->inpps = 0;
e->last_outpkts = 0; est->outpps = 0;
e->last_inbytes = 0; est->inbps = 0;
e->last_outbytes = 0; est->outbps = 0;
e->cps = 0;
e->inpps = 0;
e->outpps = 0;
e->inbps = 0;
e->outbps = 0;
}
write_unlock_bh(&est_lock);
} }
...@@ -539,6 +539,7 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler = ...@@ -539,6 +539,7 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler =
.name = "lblc", .name = "lblc",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_lblc_scheduler.n_list),
.init_service = ip_vs_lblc_init_svc, .init_service = ip_vs_lblc_init_svc,
.done_service = ip_vs_lblc_done_svc, .done_service = ip_vs_lblc_done_svc,
.update_service = ip_vs_lblc_update_svc, .update_service = ip_vs_lblc_update_svc,
...@@ -550,7 +551,6 @@ static int __init ip_vs_lblc_init(void) ...@@ -550,7 +551,6 @@ static int __init ip_vs_lblc_init(void)
{ {
int ret; int ret;
INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list);
sysctl_header = register_sysctl_paths(net_vs_ctl_path, vs_vars_table); sysctl_header = register_sysctl_paths(net_vs_ctl_path, vs_vars_table);
ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler); ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler);
if (ret) if (ret)
......
...@@ -728,6 +728,7 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler = ...@@ -728,6 +728,7 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =
.name = "lblcr", .name = "lblcr",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_lblcr_scheduler.n_list),
.init_service = ip_vs_lblcr_init_svc, .init_service = ip_vs_lblcr_init_svc,
.done_service = ip_vs_lblcr_done_svc, .done_service = ip_vs_lblcr_done_svc,
.update_service = ip_vs_lblcr_update_svc, .update_service = ip_vs_lblcr_update_svc,
...@@ -739,7 +740,6 @@ static int __init ip_vs_lblcr_init(void) ...@@ -739,7 +740,6 @@ static int __init ip_vs_lblcr_init(void)
{ {
int ret; int ret;
INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
sysctl_header = register_sysctl_paths(net_vs_ctl_path, vs_vars_table); sysctl_header = register_sysctl_paths(net_vs_ctl_path, vs_vars_table);
ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
if (ret) if (ret)
......
...@@ -98,6 +98,7 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = { ...@@ -98,6 +98,7 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = {
.name = "lc", .name = "lc",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_lc_scheduler.n_list),
.init_service = ip_vs_lc_init_svc, .init_service = ip_vs_lc_init_svc,
.done_service = ip_vs_lc_done_svc, .done_service = ip_vs_lc_done_svc,
.update_service = ip_vs_lc_update_svc, .update_service = ip_vs_lc_update_svc,
...@@ -107,7 +108,6 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = { ...@@ -107,7 +108,6 @@ static struct ip_vs_scheduler ip_vs_lc_scheduler = {
static int __init ip_vs_lc_init(void) static int __init ip_vs_lc_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_lc_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_lc_scheduler) ; return register_ip_vs_scheduler(&ip_vs_lc_scheduler) ;
} }
......
...@@ -136,6 +136,7 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler = ...@@ -136,6 +136,7 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler =
.name = "nq", .name = "nq",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_nq_scheduler.n_list),
.init_service = ip_vs_nq_init_svc, .init_service = ip_vs_nq_init_svc,
.done_service = ip_vs_nq_done_svc, .done_service = ip_vs_nq_done_svc,
.update_service = ip_vs_nq_update_svc, .update_service = ip_vs_nq_update_svc,
...@@ -145,7 +146,6 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler = ...@@ -145,7 +146,6 @@ static struct ip_vs_scheduler ip_vs_nq_scheduler =
static int __init ip_vs_nq_init(void) static int __init ip_vs_nq_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_nq_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_nq_scheduler); return register_ip_vs_scheduler(&ip_vs_nq_scheduler);
} }
......
...@@ -43,7 +43,7 @@ static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE]; ...@@ -43,7 +43,7 @@ static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE];
/* /*
* register an ipvs protocol * register an ipvs protocol
*/ */
static int __used register_ip_vs_protocol(struct ip_vs_protocol *pp) static int __used __init register_ip_vs_protocol(struct ip_vs_protocol *pp)
{ {
unsigned hash = IP_VS_PROTO_HASH(pp->protocol); unsigned hash = IP_VS_PROTO_HASH(pp->protocol);
...@@ -190,7 +190,7 @@ ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp, ...@@ -190,7 +190,7 @@ ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp,
} }
int ip_vs_protocol_init(void) int __init ip_vs_protocol_init(void)
{ {
char protocols[64]; char protocols[64];
#define REGISTER_PROTOCOL(p) \ #define REGISTER_PROTOCOL(p) \
......
...@@ -94,6 +94,7 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = { ...@@ -94,6 +94,7 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = {
.name = "rr", /* name */ .name = "rr", /* name */
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_rr_scheduler.n_list),
.init_service = ip_vs_rr_init_svc, .init_service = ip_vs_rr_init_svc,
.done_service = ip_vs_rr_done_svc, .done_service = ip_vs_rr_done_svc,
.update_service = ip_vs_rr_update_svc, .update_service = ip_vs_rr_update_svc,
...@@ -102,7 +103,6 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = { ...@@ -102,7 +103,6 @@ static struct ip_vs_scheduler ip_vs_rr_scheduler = {
static int __init ip_vs_rr_init(void) static int __init ip_vs_rr_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_rr_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_rr_scheduler); return register_ip_vs_scheduler(&ip_vs_rr_scheduler);
} }
......
...@@ -184,7 +184,7 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler) ...@@ -184,7 +184,7 @@ int register_ip_vs_scheduler(struct ip_vs_scheduler *scheduler)
write_lock_bh(&__ip_vs_sched_lock); write_lock_bh(&__ip_vs_sched_lock);
if (scheduler->n_list.next != &scheduler->n_list) { if (!list_empty(&scheduler->n_list)) {
write_unlock_bh(&__ip_vs_sched_lock); write_unlock_bh(&__ip_vs_sched_lock);
ip_vs_use_count_dec(); ip_vs_use_count_dec();
IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler " IP_VS_ERR("register_ip_vs_scheduler(): [%s] scheduler "
...@@ -229,7 +229,7 @@ int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler) ...@@ -229,7 +229,7 @@ int unregister_ip_vs_scheduler(struct ip_vs_scheduler *scheduler)
} }
write_lock_bh(&__ip_vs_sched_lock); write_lock_bh(&__ip_vs_sched_lock);
if (scheduler->n_list.next == &scheduler->n_list) { if (list_empty(&scheduler->n_list)) {
write_unlock_bh(&__ip_vs_sched_lock); write_unlock_bh(&__ip_vs_sched_lock);
IP_VS_ERR("unregister_ip_vs_scheduler(): [%s] scheduler " IP_VS_ERR("unregister_ip_vs_scheduler(): [%s] scheduler "
"is not in the list. failed\n", scheduler->name); "is not in the list. failed\n", scheduler->name);
......
...@@ -138,6 +138,7 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler = ...@@ -138,6 +138,7 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler =
.name = "sed", .name = "sed",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_sed_scheduler.n_list),
.init_service = ip_vs_sed_init_svc, .init_service = ip_vs_sed_init_svc,
.done_service = ip_vs_sed_done_svc, .done_service = ip_vs_sed_done_svc,
.update_service = ip_vs_sed_update_svc, .update_service = ip_vs_sed_update_svc,
...@@ -147,7 +148,6 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler = ...@@ -147,7 +148,6 @@ static struct ip_vs_scheduler ip_vs_sed_scheduler =
static int __init ip_vs_sed_init(void) static int __init ip_vs_sed_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_sed_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_sed_scheduler); return register_ip_vs_scheduler(&ip_vs_sed_scheduler);
} }
......
...@@ -230,6 +230,7 @@ static struct ip_vs_scheduler ip_vs_sh_scheduler = ...@@ -230,6 +230,7 @@ static struct ip_vs_scheduler ip_vs_sh_scheduler =
.name = "sh", .name = "sh",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_sh_scheduler.n_list),
.init_service = ip_vs_sh_init_svc, .init_service = ip_vs_sh_init_svc,
.done_service = ip_vs_sh_done_svc, .done_service = ip_vs_sh_done_svc,
.update_service = ip_vs_sh_update_svc, .update_service = ip_vs_sh_update_svc,
...@@ -239,7 +240,6 @@ static struct ip_vs_scheduler ip_vs_sh_scheduler = ...@@ -239,7 +240,6 @@ static struct ip_vs_scheduler ip_vs_sh_scheduler =
static int __init ip_vs_sh_init(void) static int __init ip_vs_sh_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_sh_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_sh_scheduler); return register_ip_vs_scheduler(&ip_vs_sh_scheduler);
} }
......
...@@ -904,9 +904,9 @@ int stop_sync_thread(int state) ...@@ -904,9 +904,9 @@ int stop_sync_thread(int state)
* progress of stopping the master sync daemon. * progress of stopping the master sync daemon.
*/ */
spin_lock(&ip_vs_sync_lock); spin_lock_bh(&ip_vs_sync_lock);
ip_vs_sync_state &= ~IP_VS_STATE_MASTER; ip_vs_sync_state &= ~IP_VS_STATE_MASTER;
spin_unlock(&ip_vs_sync_lock); spin_unlock_bh(&ip_vs_sync_lock);
kthread_stop(sync_master_thread); kthread_stop(sync_master_thread);
sync_master_thread = NULL; sync_master_thread = NULL;
} else if (state == IP_VS_STATE_BACKUP) { } else if (state == IP_VS_STATE_BACKUP) {
......
...@@ -126,6 +126,7 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler = ...@@ -126,6 +126,7 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler =
.name = "wlc", .name = "wlc",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_wlc_scheduler.n_list),
.init_service = ip_vs_wlc_init_svc, .init_service = ip_vs_wlc_init_svc,
.done_service = ip_vs_wlc_done_svc, .done_service = ip_vs_wlc_done_svc,
.update_service = ip_vs_wlc_update_svc, .update_service = ip_vs_wlc_update_svc,
...@@ -135,7 +136,6 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler = ...@@ -135,7 +136,6 @@ static struct ip_vs_scheduler ip_vs_wlc_scheduler =
static int __init ip_vs_wlc_init(void) static int __init ip_vs_wlc_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_wlc_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_wlc_scheduler); return register_ip_vs_scheduler(&ip_vs_wlc_scheduler);
} }
......
...@@ -212,6 +212,7 @@ static struct ip_vs_scheduler ip_vs_wrr_scheduler = { ...@@ -212,6 +212,7 @@ static struct ip_vs_scheduler ip_vs_wrr_scheduler = {
.name = "wrr", .name = "wrr",
.refcnt = ATOMIC_INIT(0), .refcnt = ATOMIC_INIT(0),
.module = THIS_MODULE, .module = THIS_MODULE,
.n_list = LIST_HEAD_INIT(ip_vs_wrr_scheduler.n_list),
.init_service = ip_vs_wrr_init_svc, .init_service = ip_vs_wrr_init_svc,
.done_service = ip_vs_wrr_done_svc, .done_service = ip_vs_wrr_done_svc,
.update_service = ip_vs_wrr_update_svc, .update_service = ip_vs_wrr_update_svc,
...@@ -220,7 +221,6 @@ static struct ip_vs_scheduler ip_vs_wrr_scheduler = { ...@@ -220,7 +221,6 @@ static struct ip_vs_scheduler ip_vs_wrr_scheduler = {
static int __init ip_vs_wrr_init(void) static int __init ip_vs_wrr_init(void)
{ {
INIT_LIST_HEAD(&ip_vs_wrr_scheduler.n_list);
return register_ip_vs_scheduler(&ip_vs_wrr_scheduler) ; return register_ip_vs_scheduler(&ip_vs_wrr_scheduler) ;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment