Re: [PATCH 02/12] xfs: consolidate buffer locking in xfs_buf_get_map

Christoph Hellwig <[email protected]> Tue, 28 Jul 2026 06:38:38 +0200
Newsgroups org.kernel.vger.linux-xfs
Message-ID <[email protected]>
On Fri, Jul 24, 2026 at 09:42:18AM -0700, Darrick J. Wong wrote:
> It could emphasize that b_lockref is used to make rcu lookups safe
> against a freed buffer whereas b_sema is used to prevent racing threads
> from doing anything non-trivial with the buffer once they've gotten
> themselves a lockref, and that's why the comment is obsolete and can go
> away.
> 
> Or modify the comment?

I've picked up a slight variant of this, thanks.

> Is there a subtlety here that the buffer creator might not be the one to
> read the buffer contents in from disk if another thread happens to find
> the buffer in the cache, take b_sema, notice that it's not XBF_DONE, and
> start the read on its own?

Yes, but it doesn't really matter.