Messages in this thread | | | Date | Sun, 12 Jun 2022 16:46:54 -1000 | From | Tejun Heo <> | Subject | Re: [PATCH RESEND v4 1/4] kernfs: make ->attr.open RCU protected. |
| |
Hello,
On Mon, Jun 13, 2022 at 12:36:12PM +1000, Imran Khan wrote: > >> +static struct kernfs_open_node * > >> +kernfs_check_open_node_protected(struct kernfs_node *kn) > >> +{ > >> + return rcu_dereference_check(kn->attr.open, > >> + lockdep_is_held(&kernfs_open_file_mutex)); > >> +} > > > > I don't understand why the above is necessary. Whether you're a reader or > > writer, you can deref the pointer w/ _protected as long as you're holding > > the lock, right? > > As per [1], we should use rcu_dereference_check() for the reader side when we > are holding the lock.
Hmm.... can you quote the exact phrase that you took the above from?
Thanks.
-- tejun
| |