Skip to content

Commit 45b90ec

Browse files
edumazetdavem330
authored andcommitted
ipv6: addrconf_disable_policy() optimization
Writing over /proc/sys/net/ipv6/conf/default/disable_policy does not need to hold RTNL. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 624d5ae commit 45b90ec

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

net/ipv6/addrconf.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6693,20 +6693,19 @@ void addrconf_disable_policy_idev(struct inet6_dev *idev, int val)
66936693
static
66946694
int addrconf_disable_policy(struct ctl_table *ctl, int *valp, int val)
66956695
{
6696+
struct net *net = (struct net *)ctl->extra2;
66966697
struct inet6_dev *idev;
6697-
struct net *net;
6698+
6699+
if (valp == &net->ipv6.devconf_dflt->disable_policy) {
6700+
WRITE_ONCE(*valp, val);
6701+
return 0;
6702+
}
66986703

66996704
if (!rtnl_trylock())
67006705
return restart_syscall();
67016706

67026707
WRITE_ONCE(*valp, val);
67036708

6704-
net = (struct net *)ctl->extra2;
6705-
if (valp == &net->ipv6.devconf_dflt->disable_policy) {
6706-
rtnl_unlock();
6707-
return 0;
6708-
}
6709-
67106709
if (valp == &net->ipv6.devconf_all->disable_policy) {
67116710
struct net_device *dev;
67126711

0 commit comments

Comments
 (0)