aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-07-08 06:05:28 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-08 06:05:28 -0400
commit81c684d12ddc05bba4953e36e9cdd5939dde344b (patch)
tree397ffc2a3e00f07d1cdda8707cf36bf3ca43268a /net/ipv4/route.c
parent2c693610fe923764fe41b846fb86938a2010da6e (diff)
ipv4: remove flush_mutex from ipv4_sysctl_rtcache_flush
It is possible to avoid locking at all in ipv4_sysctl_rtcache_flush by defining local ctl_table on the stack. The patch is based on the suggestion from Eric W. Biederman. Signed-off-by: Denis V. Lunev <den@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r--net/ipv4/route.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 113cd2512ba7..79c1e74263a1 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2873,22 +2873,20 @@ void ip_rt_multicast_event(struct in_device *in_dev)
2873} 2873}
2874 2874
2875#ifdef CONFIG_SYSCTL 2875#ifdef CONFIG_SYSCTL
2876static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write, 2876static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
2877 struct file *filp, void __user *buffer, 2877 struct file *filp, void __user *buffer,
2878 size_t *lenp, loff_t *ppos) 2878 size_t *lenp, loff_t *ppos)
2879{ 2879{
2880 if (write) { 2880 if (write) {
2881 int flush_delay; 2881 int flush_delay;
2882 ctl_table ctl;
2882 struct net *net; 2883 struct net *net;
2883 static DEFINE_MUTEX(flush_mutex);
2884 2884
2885 mutex_lock(&flush_mutex); 2885 memcpy(&ctl, __ctl, sizeof(ctl));
2886 ctl->data = &flush_delay; 2886 ctl.data = &flush_delay;
2887 proc_dointvec(ctl, write, filp, buffer, lenp, ppos); 2887 proc_dointvec(&ctl, write, filp, buffer, lenp, ppos);
2888 ctl->data = NULL;
2889 mutex_unlock(&flush_mutex);
2890 2888
2891 net = (struct net *)ctl->extra1; 2889 net = (struct net *)__ctl->extra1;
2892 rt_cache_flush(net, flush_delay); 2890 rt_cache_flush(net, flush_delay);
2893 return 0; 2891 return 0;
2894 } 2892 }