[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241108171257.i0EpS9m3@linutronix.de>
Date: Fri, 8 Nov 2024 18:12:57 +0100
From: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To: Tejun Heo <tj@...nel.org>
Cc: Boqun Feng <boqun.feng@...il.com>, Hillf Danton <hdanton@...a.com>,
"Paul E. McKenney" <paulmck@...nel.org>,
Marco Elver <elver@...gle.com>, linux-kernel@...r.kernel.org,
gregkh@...uxfoundation.org, tglx@...utronix.de,
syzbot <syzbot+6ea37e2e6ffccf41a7e6@...kaller.appspotmail.com>
Subject: Re: [BUG] -next lockdep invalid wait context
On 2024-11-08 07:02:24 [-1000], Tejun Heo wrote:
> Hello,
Hi,
> > @@ -223,12 +226,11 @@ int kernfs_name(struct kernfs_node *kn, char *buf, size_t buflen)
> > int kernfs_path_from_node(struct kernfs_node *to, struct kernfs_node *from,
> > char *buf, size_t buflen)
> > {
> > - unsigned long flags;
> > int ret;
> >
> > - read_lock_irqsave(&kernfs_rename_lock, flags);
> > + rcu_read_lock();
> > ret = kernfs_path_from_node_locked(to, from, buf, buflen);
> > - read_unlock_irqrestore(&kernfs_rename_lock, flags);
> > + rcu_read_unlock();
> > return ret;
> > }
>
> The _locked suffix looks awkward afterwards. Given that there's no
> restriction on how the function is called anymore, maybe we can just
> collapse _locked bodies into the callers?
Sure.
> ...
> > diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
> > index 87c79d076d6d7..733d89de40542 100644
> > --- a/include/linux/kernfs.h
> > +++ b/include/linux/kernfs.h
> > @@ -199,8 +199,8 @@ struct kernfs_node {
> > * never moved to a different parent, it is safe to access the
> > * parent directly.
> > */
> > - struct kernfs_node *parent;
> > - const char *name;
> > + struct kernfs_node __rcu *parent;
> > + const char __rcu *name;
>
> ->parent doesn't have to be converted to RCU. As long as the node is
> accessible, the parent is guaranteed to be pinned and unchanged. We only
> need to RCUfy ->name.
I was uncertain about parent. But in that case, let me keep parent as-is
and just do name.
Thanks.
> Thanks.
>
Sebastian
Powered by blists - more mailing lists