Skip to content

Commit 290aa0a

Browse files
w1ldptrdavem330
authored andcommitted
net: sched: don't disable bh when accessing action idr
Initial net_device implementation used ingress_lock spinlock to synchronize ingress path of device. This lock was used in both process and bh context. In some code paths action map lock was obtained while holding ingress_lock. Commit e1e992e ("[NET_SCHED] protect action config/dump from irqs") modified actions to always disable bh, while using action map lock, in order to prevent deadlock on ingress_lock in softirq. This lock was removed from net_device, so disabling bh, while accessing action map, is no longer necessary. Replace all action idr spinlock usage with regular calls that do not disable bh. Signed-off-by: Vlad Buslov <[email protected]> Acked-by: Jamal Hadi Salim <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 73bf1fc commit 290aa0a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

net/sched/act_api.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ static void free_tcf(struct tc_action *p)
7777

7878
static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p)
7979
{
80-
spin_lock_bh(&idrinfo->lock);
80+
spin_lock(&idrinfo->lock);
8181
idr_remove(&idrinfo->action_idr, p->tcfa_index);
82-
spin_unlock_bh(&idrinfo->lock);
82+
spin_unlock(&idrinfo->lock);
8383
gen_kill_estimator(&p->tcfa_rate_est);
8484
free_tcf(p);
8585
}
@@ -156,7 +156,7 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
156156
struct tc_action *p;
157157
unsigned long id = 1;
158158

159-
spin_lock_bh(&idrinfo->lock);
159+
spin_lock(&idrinfo->lock);
160160

161161
s_i = cb->args[0];
162162

@@ -191,7 +191,7 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
191191
if (index >= 0)
192192
cb->args[0] = index + 1;
193193

194-
spin_unlock_bh(&idrinfo->lock);
194+
spin_unlock(&idrinfo->lock);
195195
if (n_i) {
196196
if (act_flags & TCA_FLAG_LARGE_DUMP_ON)
197197
cb->args[1] = n_i;
@@ -261,9 +261,9 @@ static struct tc_action *tcf_idr_lookup(u32 index, struct tcf_idrinfo *idrinfo)
261261
{
262262
struct tc_action *p = NULL;
263263

264-
spin_lock_bh(&idrinfo->lock);
264+
spin_lock(&idrinfo->lock);
265265
p = idr_find(&idrinfo->action_idr, index);
266-
spin_unlock_bh(&idrinfo->lock);
266+
spin_unlock(&idrinfo->lock);
267267

268268
return p;
269269
}
@@ -323,15 +323,15 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
323323
}
324324
spin_lock_init(&p->tcfa_lock);
325325
idr_preload(GFP_KERNEL);
326-
spin_lock_bh(&idrinfo->lock);
326+
spin_lock(&idrinfo->lock);
327327
/* user doesn't specify an index */
328328
if (!index) {
329329
index = 1;
330330
err = idr_alloc_u32(idr, NULL, &index, UINT_MAX, GFP_ATOMIC);
331331
} else {
332332
err = idr_alloc_u32(idr, NULL, &index, index, GFP_ATOMIC);
333333
}
334-
spin_unlock_bh(&idrinfo->lock);
334+
spin_unlock(&idrinfo->lock);
335335
idr_preload_end();
336336
if (err)
337337
goto err3;
@@ -369,9 +369,9 @@ void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a)
369369
{
370370
struct tcf_idrinfo *idrinfo = tn->idrinfo;
371371

372-
spin_lock_bh(&idrinfo->lock);
372+
spin_lock(&idrinfo->lock);
373373
idr_replace(&idrinfo->action_idr, a, a->tcfa_index);
374-
spin_unlock_bh(&idrinfo->lock);
374+
spin_unlock(&idrinfo->lock);
375375
}
376376
EXPORT_SYMBOL(tcf_idr_insert);
377377

0 commit comments

Comments
 (0)