Linux EXT4 FS development
 help / color / mirror / Atom feed
* [PATCH] ext4: report unwritten extent conversion failures as writeback errors
@ 2026-10-15 10:29 guolingxing
  2026-10-15 10:44 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: guolingxing @ 2026-10-15 10:29 UTC (permalink / raw)
  To: Theodore Ts'o, Andreas Dilger, Baokun Li, Jan Kara,
	Ojaswin Mujoo, Ritesh Harjani, Zhang Yi
  Cc: linux-ext4, linux-kernel, stable, guolingxing

When a data writeback bio completes successfully but the subsequent
unwritten extent conversion fails, ext4_end_io_end() does not record
the error in the inode's mapping writeback error state.

Bio failures are already recorded by ext4_end_bio(), but conversion
failures are not. When the conversion is processed asynchronously,
its return value is not propagated to userspace, so fsync() may
return success despite the failed conversion.

Record conversion errors with mapping_set_error() before
ext4_release_io_end() ends folio writeback and wakes waiters. This
allows fsync() to observe the failure.

Fixes: b82e384c7bb9 ("ext4: optimize locking for end_io extent conversion")
Cc: stable@vger.kernel.org
Signed-off-by: guolingxing <guolingxing@tju.edu.cn>
---
 fs/ext4/page-io.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/ext4/page-io.c b/fs/ext4/page-io.c
index 0236b6b9785a..2afa4c096156 100644
--- a/fs/ext4/page-io.c
+++ b/fs/ext4/page-io.c
@@ -189,6 +189,8 @@ static int ext4_end_io_end(ext4_io_end_t *io_end)
 			jbd2_journal_abort(EXT4_SB(sb)->s_journal, ret);
 	} else {
 		ret = ext4_convert_unwritten_io_end_vec(handle, io_end);
+		if (ret < 0)
+			mapping_set_error(inode->i_mapping, ret);
 	}
 	if (ret < 0 && !ext4_emergency_state(sb) &&
 	    io_end->flag & EXT4_IO_END_UNWRITTEN) {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: report unwritten extent conversion failures as writeback errors
  2026-10-15 10:29 [PATCH] ext4: report unwritten extent conversion failures as writeback errors guolingxing
@ 2026-10-15 10:44 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-10-15 10:44 UTC (permalink / raw)
  To: guolingxing; +Cc: linux-ext4, tytso

> When a data writeback bio completes successfully but the subsequent
> unwritten extent conversion fails, ext4_end_io_end() does not record
> the error in the inode's mapping writeback error state.
> 
> Bio failures are already recorded by ext4_end_bio(), but conversion
> failures are not. When the conversion is processed asynchronously,
> its return value is not propagated to userspace, so fsync() may
> return success despite the failed conversion.
> 
> Record conversion errors with mapping_set_error() before
> ext4_release_io_end() ends folio writeback and wakes waiters. This
> allows fsync() to observe the failure.
> 
> Fixes: b82e384c7bb9 ("ext4: optimize locking for end_io extent conversion")
> Cc: stable@vger.kernel.org
> Signed-off-by: guolingxing <guolingxing@tju.edu.cn>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261015102943.74632-1-guolingxing@tju.edu.cn?part=1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-15 10:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-15 10:29 [PATCH] ext4: report unwritten extent conversion failures as writeback errors guolingxing
2026-10-15 10:44 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox