[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240219180641.hdd5q2vvx5sixuh6@quack3>
Date: Mon, 19 Feb 2024 19:06:41 +0100
From: Jan Kara <jack@...e.cz>
To: "Liam R. Howlett" <Liam.Howlett@...cle.com>
Cc: Jan Kara <jack@...e.cz>, Chuck Lever <cel@...nel.org>,
viro@...iv.linux.org.uk, brauner@...nel.org, hughd@...gle.com,
akpm@...ux-foundation.org, oliver.sang@...el.com,
feng.tang@...el.com, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, maple-tree@...ts.infradead.org,
linux-mm@...ck.org, lkp@...el.com
Subject: Re: [PATCH RFC 7/7] libfs: Re-arrange locking in offset_iterate_dir()
On Fri 16-02-24 11:33:18, Liam R. Howlett wrote:
> * Jan Kara <jack@...e.cz> [240216 05:15]:
> > > If you have other examples you think are unsafe then I can have a look
> > > at them as well.
> >
> > I'm currently not aware of any but I'll let you know if I find some.
> > Missing xas/mas_pause() seems really easy.
>
> What if we convert the rcu_read_lock() to a mas_read_lock() or
> xas_read_lock() and we can check to ensure the state isn't being locked
> without being in the 'parked' state (paused or otherwise)?
>
> mas_read_lock(struct ma_state *mas) {
> assert(!mas_active(mas));
> rcu_read_lock();
> }
>
> Would that be a reasonable resolution to your concern? Unfortunately,
> what was done with the locking in this case would not be detected with
> this change unless the rcu_read_lock() was replaced. IOW, people could
> still use the rcu_read_lock() and skip the detection.
Yes, I guess this is still better than nothing.
> Doing the same in the mas_unlock() doesn't make as much sense since that
> may be called without the intent to reuse the state at all. So we'd be
> doing more work than necessary at the end of each loop or use.
Yes, understood.
Honza
--
Jan Kara <jack@...e.com>
SUSE Labs, CR
Powered by blists - more mailing lists