ipmr: adopt rcu_read_lock() in mr_dump()
We no longer need to acquire mrt_lock() in mr_dump, using rcu_read_lock() is enough. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
6fa40a2902
Коммит
194366b28b
|
@ -308,7 +308,7 @@ int mr_dump(struct net *net, struct notifier_block *nb, unsigned short family,
|
|||
struct netlink_ext_ack *extack),
|
||||
struct mr_table *(*mr_iter)(struct net *net,
|
||||
struct mr_table *mrt),
|
||||
rwlock_t *mrt_lock, struct netlink_ext_ack *extack);
|
||||
struct netlink_ext_ack *extack);
|
||||
#else
|
||||
static inline void vif_device_init(struct vif_device *v,
|
||||
struct net_device *dev,
|
||||
|
@ -363,7 +363,7 @@ static inline int mr_dump(struct net *net, struct notifier_block *nb,
|
|||
struct netlink_ext_ack *extack),
|
||||
struct mr_table *(*mr_iter)(struct net *net,
|
||||
struct mr_table *mrt),
|
||||
rwlock_t *mrt_lock, struct netlink_ext_ack *extack)
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -3027,7 +3027,7 @@ static int ipmr_dump(struct net *net, struct notifier_block *nb,
|
|||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
return mr_dump(net, nb, RTNL_FAMILY_IPMR, ipmr_rules_dump,
|
||||
ipmr_mr_table_iter, &mrt_lock, extack);
|
||||
ipmr_mr_table_iter, extack);
|
||||
}
|
||||
|
||||
static const struct fib_notifier_ops ipmr_notifier_ops_template = {
|
||||
|
|
|
@ -399,7 +399,6 @@ int mr_dump(struct net *net, struct notifier_block *nb, unsigned short family,
|
|||
struct netlink_ext_ack *extack),
|
||||
struct mr_table *(*mr_iter)(struct net *net,
|
||||
struct mr_table *mrt),
|
||||
rwlock_t *mrt_lock,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mr_table *mrt;
|
||||
|
@ -416,10 +415,9 @@ int mr_dump(struct net *net, struct notifier_block *nb, unsigned short family,
|
|||
int vifi;
|
||||
|
||||
/* Notifiy on table VIF entries */
|
||||
read_lock(mrt_lock);
|
||||
rcu_read_lock();
|
||||
for (vifi = 0; vifi < mrt->maxvif; vifi++, v++) {
|
||||
vif_dev = rcu_dereference_check(v->dev,
|
||||
lockdep_is_held(mrt_lock));
|
||||
vif_dev = rcu_dereference(v->dev);
|
||||
if (!vif_dev)
|
||||
continue;
|
||||
|
||||
|
@ -430,7 +428,7 @@ int mr_dump(struct net *net, struct notifier_block *nb, unsigned short family,
|
|||
if (err)
|
||||
break;
|
||||
}
|
||||
read_unlock(mrt_lock);
|
||||
rcu_read_unlock();
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
|
|
@ -1267,7 +1267,7 @@ static int ip6mr_dump(struct net *net, struct notifier_block *nb,
|
|||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
return mr_dump(net, nb, RTNL_FAMILY_IP6MR, ip6mr_rules_dump,
|
||||
ip6mr_mr_table_iter, &mrt_lock, extack);
|
||||
ip6mr_mr_table_iter, extack);
|
||||
}
|
||||
|
||||
static struct notifier_block ip6_mr_notifier = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче