]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: fix error handling of fallback uncompress write
authorNaohiro Aota <naohiro.aota@wdc.com>
Tue, 21 Jun 2022 06:41:01 +0000 (15:41 +0900)
committerDavid Sterba <dsterba@suse.com>
Mon, 25 Jul 2022 15:45:38 +0000 (17:45 +0200)
commit3d786657df54801ca96a4d4e17110ef6cf03e7d3
tree48080a79554a26b3aa92c316fde0a6fa79602bfc
parent5625a4143195bf1b816413d2398bf0821b02bc6c
btrfs: fix error handling of fallback uncompress write

When cow_file_range() fails in the middle of the allocation loop, it
unlocks the pages but leaves the ordered extents intact. Thus, we need
to call btrfs_cleanup_ordered_extents() to finish the created ordered
extents.

Also, we need to call end_extent_writepage() if locked_page is available
because btrfs_cleanup_ordered_extents() never processes the region on
the locked_page.

Furthermore, we need to set the mapping as error if locked_page is
unavailable before unlocking the pages, so that the errno is properly
propagated to the user space.

CC: stable@vger.kernel.org # 5.18+
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c