Re: [PATCH v2] fs/buffer: serialize set_buffer_uptodate against concurrent clears

Matthew Wilcox <[email protected]>
Newsgroups org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Thu, Jul 30, 2026 at 03:47:23PM -0400, Chris S wrote:
> Hi Jan, I'm currently working on the changes we discussed.  Based on
> vfs.all now.  Four things came out of writing it that I would rather
> resolve before posting.
> 
> 1. mark_buffer_write_io_error() is not safe for jbd2's buffers yet.  It
> dereferences bh->b_folio->mapping directly (fs/buffer.c:1057), and
> jbd2_journal_write_metadata_buffer() points the temporary bh at
> virt_to_folio(jh->b_frozen_data), which is slab-backed.

... yeah.  That's one of the unclean things which keeps me awake at
night.  Sorry you ran into it.

My longterm plan for this particular usecase (pointing a bh at slab
memory) is to have bh->b_folio = NULL, bh->b_data = (address of data).
Maybe we could do that now?  That would make mark_buffer_write_io_error()
work without change today.

There might be a good reason I didn't do that yet, but I forget what it
was.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.