aboutsummaryrefslogtreecommitdiffstats
path: root/net/netfilter/ipvs/ip_vs_wrr.c
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2009-08-31 14:18:48 +0200
committerPatrick McHardy <kaber@trash.net>2009-08-31 14:18:48 +0200
commit1e66dafc75f40a08b2addb82779987b269b4ca23 (patch)
tree8e8804cb6ffdd05e5ac7758d0559d4698026dd65 /net/netfilter/ipvs/ip_vs_wrr.c
parent3993832464dd4e14a4c926583a11f0fa92c1f0f0 (diff)
downloadkernel_samsung_smdk4412-1e66dafc75f40a08b2addb82779987b269b4ca23.zip
kernel_samsung_smdk4412-1e66dafc75f40a08b2addb82779987b269b4ca23.tar.gz
kernel_samsung_smdk4412-1e66dafc75f40a08b2addb82779987b269b4ca23.tar.bz2
ipvs: Use atomic operations atomicly
A pointed out by Shin Hong, IPVS doesn't always use atomic operations in an atomic manner. While this seems unlikely to be manifest in strange behaviour, it seems appropriate to clean this up. Cc: shin hong <hongshin@gmail.com> Signed-off-by: Simon Horman <horms@verge.net.au> Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net/netfilter/ipvs/ip_vs_wrr.c')
-rw-r--r--net/netfilter/ipvs/ip_vs_wrr.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/netfilter/ipvs/ip_vs_wrr.c b/net/netfilter/ipvs/ip_vs_wrr.c
index 70ff82cd..6182e8e 100644
--- a/net/netfilter/ipvs/ip_vs_wrr.c
+++ b/net/netfilter/ipvs/ip_vs_wrr.c
@@ -77,11 +77,12 @@ static int ip_vs_wrr_gcd_weight(struct ip_vs_service *svc)
static int ip_vs_wrr_max_weight(struct ip_vs_service *svc)
{
struct ip_vs_dest *dest;
- int weight = 0;
+ int new_weight, weight = 0;
list_for_each_entry(dest, &svc->destinations, n_list) {
- if (atomic_read(&dest->weight) > weight)
- weight = atomic_read(&dest->weight);
+ new_weight = atomic_read(&dest->weight);
+ if (new_weight > weight)
+ weight = new_weight;
}
return weight;