summaryrefslogtreecommitdiff
path: root/net/ipv4/route.c
diff options
context:
space:
mode:
authorDenis V. Lunev <den@openvz.org>2008-07-08 03:05:28 -0700
committerDavid S. Miller <davem@davemloft.net>2008-07-08 03:05:28 -0700
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)
}
#ifdef CONFIG_SYSCTL
-static int ipv4_sysctl_rtcache_flush(ctl_table *ctl, int write,
+static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write,
struct file *filp, void __user *buffer,
size_t *lenp, loff_t *ppos)
{
if (write) {
int flush_delay;
+ ctl_table ctl;
struct net *net;
- static DEFINE_MUTEX(flush_mutex);
- mutex_lock(&flush_mutex);
- ctl->data = &flush_delay;
- proc_dointvec(ctl, write, filp, buffer, lenp, ppos);
- ctl->data = NULL;
- mutex_unlock(&flush_mutex);
+ memcpy(&ctl, __ctl, sizeof(ctl));
+ ctl.data = &flush_delay;
+ proc_dointvec(&ctl, write, filp, buffer, lenp, ppos);
- net = (struct net *)ctl->extra1;
+ net = (struct net *)__ctl->extra1;
rt_cache_flush(net, flush_delay);
return 0;
}