mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 07:44:21 +08:00
net/sched: taprio: taprio_dump and taprio_change are protected by rtnl_mutex
Since the writer-side lock is taken here, we do not need to open an RCU read-side critical section, instead we can use rtnl_dereference() to tell lockdep we are serialized with concurrent writes. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
c8cbe123be
commit
18cdd2f099
@ -1484,10 +1484,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
|
|||||||
}
|
}
|
||||||
INIT_LIST_HEAD(&new_admin->entries);
|
INIT_LIST_HEAD(&new_admin->entries);
|
||||||
|
|
||||||
rcu_read_lock();
|
oper = rtnl_dereference(q->oper_sched);
|
||||||
oper = rcu_dereference(q->oper_sched);
|
admin = rtnl_dereference(q->admin_sched);
|
||||||
admin = rcu_dereference(q->admin_sched);
|
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
/* no changes - no new mqprio settings */
|
/* no changes - no new mqprio settings */
|
||||||
if (!taprio_mqprio_cmp(dev, mqprio))
|
if (!taprio_mqprio_cmp(dev, mqprio))
|
||||||
@ -1878,9 +1876,8 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
struct nlattr *nest, *sched_nest;
|
struct nlattr *nest, *sched_nest;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
rcu_read_lock();
|
oper = rtnl_dereference(q->oper_sched);
|
||||||
oper = rcu_dereference(q->oper_sched);
|
admin = rtnl_dereference(q->admin_sched);
|
||||||
admin = rcu_dereference(q->admin_sched);
|
|
||||||
|
|
||||||
opt.num_tc = netdev_get_num_tc(dev);
|
opt.num_tc = netdev_get_num_tc(dev);
|
||||||
memcpy(opt.prio_tc_map, dev->prio_tc_map, sizeof(opt.prio_tc_map));
|
memcpy(opt.prio_tc_map, dev->prio_tc_map, sizeof(opt.prio_tc_map));
|
||||||
@ -1924,8 +1921,6 @@ static int taprio_dump(struct Qdisc *sch, struct sk_buff *skb)
|
|||||||
nla_nest_end(skb, sched_nest);
|
nla_nest_end(skb, sched_nest);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
rcu_read_unlock();
|
|
||||||
|
|
||||||
return nla_nest_end(skb, nest);
|
return nla_nest_end(skb, nest);
|
||||||
|
|
||||||
admin_error:
|
admin_error:
|
||||||
@ -1935,7 +1930,6 @@ options_error:
|
|||||||
nla_nest_cancel(skb, nest);
|
nla_nest_cancel(skb, nest);
|
||||||
|
|
||||||
start_error:
|
start_error:
|
||||||
rcu_read_unlock();
|
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user