Re: [PATCH v3] kernfs: Use RCU for kernfs_node::name and ::parent lookup.
From: Michal Koutný
Date: Wed Dec 11 2024 - 10:36:48 EST
On Mon, Nov 25, 2024 at 07:02:26PM GMT, Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:
> Assuming the parent can't vanish in these cases, name could during the
> invocation.
^^^^^^^^^^
So those R-locks are likely missing even prior this RCUization (as
pointed out by Tejun).
If I don't miss context, this would be better a separate pre-patch.
> I can't keep the RCU read section open while there is a
> sleep within the call chain. Therefore I added the lock so the
> rcu_dereference.*() is quiet.
Ah, right.
>
> > (Perhaps it's related to second observation I have -- why there is
> > sometimes kernfs_rcu_get_parent() whereas there are other call sites
> > with mere rcu_dereference(kn->parent)?)
>
> rcu_dereference() is used where I was sure that there is always a RCU
> read section. I have kernfs_rcu_get_parent() when there is either a RCU
> read section or the kernfs_rwsem (or just the lock).
I think context-less rcu_dereference_check wrapper (with a comment)
could capture that semantics too.
Michal
Attachment:
signature.asc
Description: PGP signature