Re: [Patch net-next] act_mirred: get rid of mirred_list_lock spinlock
From: Eric Dumazet <hidden>
Date: 2017-11-30 23:12:07
On Thu, 2017-11-30 at 14:53 -0800, Cong Wang wrote:
quoted hunk ↗ jump to hunk
TC actions are no longer freed in RCU callbacks and we should always have RTNL lock, so this spinlock is no longer needed. Cc: Jiri Pirko <redacted> Cc: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: Cong Wang <redacted> --- net/sched/act_mirred.c | 8 -------- 1 file changed, 8 deletions(-)diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index fe6489f9c3cf..2c51952bf2d4 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c@@ -29,7 +29,6 @@#include <net/tc_act/tc_mirred.h> static LIST_HEAD(mirred_list); -static DEFINE_SPINLOCK(mirred_list_lock); static bool tcf_mirred_is_act_redirect(int action) {@@ -55,13 +54,10 @@ static void tcf_mirred_release(struct tc_action*a, int bind) struct tcf_mirred *m = to_mirred(a); struct net_device *dev; - /* We could be called either in a RCU callback or with RTNL lock held. */ - spin_lock_bh(&mirred_list_lock); list_del(&m->tcfm_list); dev = rcu_dereference_protected(m->tcfm_dev, 1);
If RTNL is held at this point, I suggest to use rtnl_dereference() instead of rcu_dereference_protected() to get proper lockdep coverage.
if (dev) dev_put(dev); - spin_unlock_bh(&mirred_list_lock); }