(Sorry for joining this late.) On Mon, Feb 11, 2019 at 12:56 AM Vlad Buslov <vla...@mellanox.com> wrote: > @@ -2432,7 +2474,11 @@ static int tc_dump_chain(struct sk_buff *skb, struct > netlink_callback *cb) > index_start = cb->args[0]; > index = 0; > > - list_for_each_entry(chain, &block->chain_list, list) { > + for (chain = __tcf_get_next_chain(block, NULL); > + chain; > + chain_prev = chain, > + chain = __tcf_get_next_chain(block, chain), > + tcf_chain_put(chain_prev)) {
Why do you want to take the block->lock in each iteration of the loop rather than taking once for the whole loop?