diff options
author | Julian Anastasov | 2013-03-22 10:46:37 +0100 |
---|---|---|
committer | Pablo Neira Ayuso | 2013-04-02 00:23:47 +0200 |
commit | 6b6df46663e7aa6f7b1d82435a3488f9b81316b3 (patch) | |
tree | 72d44c02f38bbe96bc4a468da732abbd23037008 /net/netfilter/ipvs/ip_vs_ctl.c | |
parent | ipvs: change ip_vs_sched_lock to mutex (diff) | |
download | kernel-qcow2-linux-6b6df46663e7aa6f7b1d82435a3488f9b81316b3.tar.gz kernel-qcow2-linux-6b6df46663e7aa6f7b1d82435a3488f9b81316b3.tar.xz kernel-qcow2-linux-6b6df46663e7aa6f7b1d82435a3488f9b81316b3.zip |
ipvs: preparations for using rcu in schedulers
Allow schedulers to use rcu_dereference when
returning destination on lookup. The RCU read-side critical
section will allow ip_vs_bind_dest to get dest refcnt as
preparation for the step where destinations will be
deleted without an IP_VS_WAIT_WHILE guard that holds the
packet processing during update.
Add new optional scheduler methods add_dest,
del_dest and upd_dest. For now the methods are called
together with update_service but update_service will be
removed in a following change.
Signed-off-by: Julian Anastasov <ja@ssi.bg>
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'net/netfilter/ipvs/ip_vs_ctl.c')
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 182d95807bd5..d64f800a3426 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c @@ -825,6 +825,11 @@ __ip_vs_update_dest(struct ip_vs_service *svc, struct ip_vs_dest *dest, if (add) { list_add(&dest->n_list, &svc->destinations); svc->num_dests++; + if (svc->scheduler->add_dest) + svc->scheduler->add_dest(svc, dest); + } else { + if (svc->scheduler->upd_dest) + svc->scheduler->upd_dest(svc, dest); } /* call the update_service, because server weight may be changed */ @@ -1071,6 +1076,9 @@ static void __ip_vs_unlink_dest(struct ip_vs_service *svc, list_del(&dest->n_list); svc->num_dests--; + if (svcupd && svc->scheduler->del_dest) + svc->scheduler->del_dest(svc, dest); + /* * Call the update_service function of its scheduler */ |