]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: return any hit error from extent_writepage_io()
authorQu Wenruo <wqu@suse.com>
Wed, 17 Sep 2025 23:10:45 +0000 (08:40 +0930)
committerDavid Sterba <dsterba@suse.com>
Tue, 23 Sep 2025 06:49:23 +0000 (08:49 +0200)
commit2d83ed6c6c4607b42ee7927e92a9d2fa31d6f30b
treef47ee5c401d6a4551f60725daf1d0d9f883ee5d6
parent5afe85b771eefe91891cca332cb916f8da6d48e1
btrfs: return any hit error from extent_writepage_io()

Since the support of bs < ps support, extent_writepage_io() will submit
multiple blocks inside the folio.

But if we hit error submitting one sector, but the next sector can still
be submitted successfully, the function extent_writepage_io() will still
return 0.

This will make btrfs to silently ignore the error without setting error
flag for the filemap.

Fix it by recording the first error hit, and always return that value.

Fixes: 8bf334beb349 ("btrfs: fix double accounting race when extent_writepage_io() failed")
Reviewed-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent_io.c