Subject: Re: [PATCH 29/38] cls_flower: Convert handle_idr to XArray

From: Vlad Buslov <[email-masked]>
Date: Mon, 26 Aug 2019 10:11:49 +0000

On Sun 25 Aug 2019 at 21:32, Cong Wang <[email-masked]> wrote:
> On Wed, Aug 21, 2019 at 11:27 AM Vlad Buslov <[email-masked]> wrote:
>> At first I was confused why you bring up rtnl lock in commit message
>> (flower classifier has 'unlocked' flag set and can't rely on it anymore)
>> but looking at the code I see that we lost rcu read lock here in commit
>> d39d714969cd ("idr: introduce idr_for_each_entry_continue_ul()") and you
>> are correctly bringing it back. Adding Cong to advise if it is okay to
>> wait for this patch to be accepted or we need to proceed with fixing the
>> missing RCU lock as a standalone patch.
>
> Hmm? Isn't ->walk() still called with RTNL lock? tcf_chain_dump()
> calls __tcf_get_next_proto() which asserts RTNL.
>
> So why does it still need RCU read lock when having RTNL?

Individual filters can be deleted without obtaining rtnl lock. And
without rcu read lock, f can be deallocated in fl_walk() main loop
before refcount_inc_not_zero() obtains reference to it.