summaryrefslogtreecommitdiffstats
path: root/net/ipv4/devinet.c
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2017-10-16 09:44:36 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-16 16:26:40 -0400
commit5fa85a09390c4a525cb4d06a0c4644b01a47976b (patch)
tree83d6e4eee4a33ccd89af13691b484c59489d4f7f /net/ipv4/devinet.c
parent070cbf5be7774dcf0ceca081c7321c6f2ae833a4 (diff)
net: core: rcu-ify rtnl af_ops
rtnl af_ops currently rely on rtnl mutex: unregister (called from module exit functions) takes the rtnl mutex and all users that do af_ops lookup also take the rtnl mutex. IOW, parallel rmmod will block until doit() callback is done. As none of the af_ops implementation sleep we can use rcu instead. doit functions that need the af_ops can now use rcu instead of the rtnl mutex provided the mutex isn't needed for other reasons. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r--net/ipv4/devinet.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 7ce22a2c07ce..6d9b072d903b 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1757,7 +1757,7 @@ static int inet_validate_link_af(const struct net_device *dev,
1757 struct nlattr *a, *tb[IFLA_INET_MAX+1]; 1757 struct nlattr *a, *tb[IFLA_INET_MAX+1];
1758 int err, rem; 1758 int err, rem;
1759 1759
1760 if (dev && !__in_dev_get_rtnl(dev)) 1760 if (dev && !__in_dev_get_rcu(dev))
1761 return -EAFNOSUPPORT; 1761 return -EAFNOSUPPORT;
1762 1762
1763 err = nla_parse_nested(tb, IFLA_INET_MAX, nla, inet_af_policy, NULL); 1763 err = nla_parse_nested(tb, IFLA_INET_MAX, nla, inet_af_policy, NULL);
@@ -1781,7 +1781,7 @@ static int inet_validate_link_af(const struct net_device *dev,
1781 1781
1782static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla) 1782static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla)
1783{ 1783{
1784 struct in_device *in_dev = __in_dev_get_rtnl(dev); 1784 struct in_device *in_dev = __in_dev_get_rcu(dev);
1785 struct nlattr *a, *tb[IFLA_INET_MAX+1]; 1785 struct nlattr *a, *tb[IFLA_INET_MAX+1];
1786 int rem; 1786 int rem;
1787 1787