Re: [PATCH v3] kernfs: Use RCU for kernfs_node::name and ::parent lookup.
From: Michal Koutný
Date: Mon Nov 25 2024 - 10:10:03 EST
Hello.
On Thu, Nov 21, 2024 at 06:52:50PM GMT, Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> wrote:
> - kernfs_rename_ns() is only using kernfs_rename_lock if the parents are
> different. All users users use either RCU or kernfs_rwsem.
> - kernfs_fop_readdir() drops kernfs_root::kernfs_rwsem while holding a
> reference to name and invoking dir_emit(). This has been changed and
> lock is held.
> - kernfs_notify_workfn() access kernfs_node::name without any
> protection. Added kernfs_root::kernfs_rwsem for the iteration.
> - kernfs_get_parent_dentry() acquires now kernfs_root::kernfs_rwsem
> while accessing the parent node.
> - kernfs_node_dentry() acquires now kernfs_root::kernfs_rwsem while
> parent is accessed and the name looked up.
Why is the kernfs_root::kernfs_rwsem newly R-taken? Shouldn't be RCU
read section sufficient for those users?
(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)?)
Attachment:
signature.asc
Description: PGP signature