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

Jan Kara <[email protected]> Tue, 4 Aug 2026 11:07:20 +0200
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 <liddhnv7367ifj3mk5qokdax5jexltpvbtxpkqpkt6qzolv7af@zll26cngckwl>
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_blks)
>  		 * Update j_fc_off so jbd2_fc_release_bufs can release remain
>  		 * buffer head.
>  		 */
> -		if (unlikely(!buffer_uptodate(bh))) {
> +		if (unlikely(buffer_write_io_error(bh))) {
>  			journal->j_fc_off = i + 1;
>  			return -EIO;
>  		}
> -- 
> 2.43.0
> 
-- 
Jan Kara <[email protected]>
SUSE Labs, CR