lkml.org 
[lkml]   [2022]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2022-06-13 04:47    [W:0.045 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site