On Thu, Sep 7, 2017 at 1:52 PM, Jiri Pirko <j...@resnulli.us> wrote: > Thu, Sep 07, 2017 at 07:45:49PM CEST, xiyou.wangc...@gmail.com wrote: >>Yes it is for chain 0, because block holds a reference to chain 0 during >>creation. Non-0 chains are created with refcnt==1 too but paired with >>tcf_chain_put() rather than tcf_block_put(). This is what makes chain 0 >>not special w.r.t. refcnt. > > So you need to tcf_chain_put only chain 0 here, right? The rest of the > chains get destroyed by the previous list_for_each_entry iteration when > flush happens and actions destroy happens what decrements recnt to 0 > there.
This is correct. And it should be only chain 0 after flush. > > What do I miss, who would still hold reference for non-0 chains when all > tps and all goto_chain actions are gone? No one. This is totally correct and is exactly what this patch intends to do. Look, this is why we never need an object with refcnt==0 to exist. ;)