• Naohiro Aota's avatar
    btrfs: fix error handling of fallback uncompress write · 71aa147b
    Naohiro Aota authored
    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: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarNaohiro Aota <naohiro.aota@wdc.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    71aa147b
inode.c 325 KB