Commit 45b90ec9 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

ipv6: addrconf_disable_policy() optimization

Writing over /proc/sys/net/ipv6/conf/default/disable_policy
does not need to hold RTNL.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 624d5aec
...@@ -6693,20 +6693,19 @@ void addrconf_disable_policy_idev(struct inet6_dev *idev, int val) ...@@ -6693,20 +6693,19 @@ void addrconf_disable_policy_idev(struct inet6_dev *idev, int val)
static static
int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val) int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val)
{ {
struct net *net = (struct net *)ctl->extra2;
struct inet6_dev *idev; struct inet6_dev *idev;
struct net *net;
if (valp == &net->ipv6.devconf_dflt->disable_policy) {
WRITE_ONCE(*valp, val);
return 0;
}
if (!rtnl_trylock()) if (!rtnl_trylock())
return restart_syscall(); return restart_syscall();
WRITE_ONCE(*valp, val); WRITE_ONCE(*valp, val);
net = (struct net *)ctl->extra2;
if (valp == &net->ipv6.devconf_dflt->disable_policy) {
rtnl_unlock();
return 0;
}
if (valp == &net->ipv6.devconf_all->disable_policy) { if (valp == &net->ipv6.devconf_all->disable_policy) {
struct net_device *dev; struct net_device *dev;
......
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