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>
This commit is contained in:

committed by
David S. Miller

parent
070cbf5be7
commit
5fa85a0939
@@ -1757,7 +1757,7 @@ static int inet_validate_link_af(const struct net_device *dev,
|
||||
struct nlattr *a, *tb[IFLA_INET_MAX+1];
|
||||
int err, rem;
|
||||
|
||||
if (dev && !__in_dev_get_rtnl(dev))
|
||||
if (dev && !__in_dev_get_rcu(dev))
|
||||
return -EAFNOSUPPORT;
|
||||
|
||||
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,
|
||||
|
||||
static int inet_set_link_af(struct net_device *dev, const struct nlattr *nla)
|
||||
{
|
||||
struct in_device *in_dev = __in_dev_get_rtnl(dev);
|
||||
struct in_device *in_dev = __in_dev_get_rcu(dev);
|
||||
struct nlattr *a, *tb[IFLA_INET_MAX+1];
|
||||
int rem;
|
||||
|
||||
|
Reference in New Issue
Block a user