]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
Btrfs: fix missing error return if writeback for extent buffer never started
authorFilipe Manana <fdmanana@suse.com>
Wed, 11 Sep 2019 16:42:28 +0000 (17:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 18:18:43 +0000 (19:18 +0100)
commitb98f2b8fb91bbe82b5372ce782ce619da57eff1c
treed6250558929db2d3606fc31c9c556752ae3890e6
parent0982aa54d054bf11fe202522e29e4da9b288653b
Btrfs: fix missing error return if writeback for extent buffer never started

[ Upstream commit 0607eb1d452d45c5ac4c745a9e9e0d95152ea9d0 ]

If lock_extent_buffer_for_io() fails, it returns a negative value, but its
caller btree_write_cache_pages() ignores such error. This means that a
call to flush_write_bio(), from lock_extent_buffer_for_io(), might have
failed. We should make btree_write_cache_pages() notice such error values
and stop immediatelly, making sure filemap_fdatawrite_range() returns an
error to the transaction commit path. A failure from flush_write_bio()
should also result in the endio callback end_bio_extent_buffer_writepage()
being invoked, which sets the BTRFS_FS_*_ERR bits appropriately, so that
there's no risk a transaction or log commit doesn't catch a writeback
failure.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/extent_io.c