Messages in this thread | | | Date | Mon, 13 Jun 2022 17:19:03 -1000 | From | Tejun Heo <> | Subject | Re: [PATCH v5 1/4] kernfs: make ->attr.open RCU protected. |
| |
On Tue, Jun 14, 2022 at 12:08:37PM +1000, Imran Khan wrote: > +static struct kernfs_open_node * > +kernfs_deref_open_node(struct kernfs_open_file *of, struct kernfs_node *kn) > +{ > + struct kernfs_open_node *on; > + bool deref_ok; > + > + deref_ok = (of ? !list_empty(&of->list) : false) || > + lockdep_is_held(&kernfs_open_file_mutex); > + > + on = rcu_dereference_check(kn->attr.open, deref_ok); > + > + return on; > +}
Hahahaha didn't know they'd be taking two different arguments. Sorry about the many iterations but it'd probably be better to have two different versions for the two argument types. Other than that, looks fine to me.
Thanks.
-- tejun
| |