Re: [PATCH 18/19] ext4, jbd2: report fast commit write errors with BH_Write_EIO

Chris S <[email protected]> Wed, 5 Aug 2026 16:35:22 -0400
Newsgroups org.kernel.vger.linux-ext4,dev.linux.lists.gfs2,dev.linux.lists.ocfs2-devel,org.kernel.vger.linux-fsdevel,org.kernel.vger.linux-kernel
Message-ID <CACd_6n0tmOQpams--XGDWcBWA9VTKgN1QOxU9i1FbbgnNCuqyw@mail.gmail.com>
Done in v2 - 'success', no set_buffer_uptodate(), and the debug messages no=
w
talk about the write rather than the buffer:

     if (success) {
                   ext4_debug("%s: Block %lld written", ...);
     } else {
                   ext4_debug("%s: Block %lld write failed", ...);
                   mark_buffer_write_io_error(bh);
     }

Both arms kept so the tracing stays symmetric; patch 21 adds the
clear_buffer_write_io_error() to the first one.

Best,
Chao

On Tue, Aug 4, 2026 at 5:07=E2=80=AFAM Jan Kara <[email protected]> wrote:
>
> On Sat 01-08-26 18:01:02, Chao Shi wrote:
> > ext4_end_buffer_io_sync() is the third completion handler in this
> > series that reports a failed write by clearing BH_Uptodate, and
> > jbd2_fc_wait_bufs() is the only thing that looks at the result.
> > Convert both.
> >
> > They have to move in the same patch.  The handler lives in ext4 and
> > the wait in jbd2, but neither is used by anything else: the buffers
> > are ext4's fast commit blocks, submitted by ext4_fc_submit_bh() and
> > waited for by jbd2_fc_wait_bufs().  Converting one without the other
> > silently disables fast commit write error reporting.
> >
> > Signed-off-by: Chao Shi <[email protected]>
> > ---
> >  fs/ext4/fast_commit.c | 2 +-
> >  fs/jbd2/journal.c     | 2 +-
> >  2 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
> > index 8e2259799614..8cd60c9f2272 100644
> > --- a/fs/ext4/fast_commit.c
> > +++ b/fs/ext4/fast_commit.c
> > @@ -213,7 +213,7 @@ static void ext4_end_buffer_io_sync(struct bio *bio=
)
> >       } else {
> >               ext4_debug("%s: Block %lld not up-to-date",
> >                          __func__, bh->b_blocknr);
> > -             clear_buffer_uptodate(bh);
> > +             mark_buffer_write_io_error(bh);
> >       }
>
> Again, this is only ever used for writes and buffer is guaranteed to be
> uptodate so please rename 'uptodate' to 'ioerr' and remove the setting of
> uptodate bit as well. And the ext4_debug() messages need slight update as
> well.
>
>                                                                 Honza
>
> >
> >       unlock_buffer(bh);
> > diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
> > index 9e4cb04587b4..ffe7a22e6699 100644
> > --- a/fs/jbd2/journal.c
> > +++ b/fs/jbd2/journal.c
> > @@ -890,7 +890,7 @@ int jbd2_fc_wait_bufs(journal_t *journal, int num_b=
lks)
> >                * Update j_fc_off so jbd2_fc_release_bufs can release re=
main
> >                * buffer head.
> >                */
> > -             if (unlikely(!buffer_uptodate(bh))) {
> > +             if (unlikely(buffer_write_io_error(bh))) {
> >                       journal->j_fc_off =3D i + 1;
> >                       return -EIO;
> >               }
> > --
> > 2.43.0
> >
> --
> Jan Kara <[email protected]>
> SUSE Labs, CR