Commit 2b107726 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by Greg Kroah-Hartman

btrfs: Handle btrfs_set_extent_delalloc failure in fixup worker

commit f3038ee3 upstream.

This function was introduced by 247e743c ("Btrfs: Use async helpers
to deal with pages that have been improperly dirtied") and it didn't do
any error handling then. This function might very well fail in ENOMEM
situation, yet it's not handled, this could lead to inconsistent state.
So let's handle the failure by setting the mapping error bit.
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarQu Wenruo <wqu@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36675d5d
......@@ -2015,7 +2015,15 @@ static void btrfs_writepage_fixup_worker(struct btrfs_work *work)
goto out;
}
btrfs_set_extent_delalloc(inode, page_start, page_end, &cached_state);
ret = btrfs_set_extent_delalloc(inode, page_start, page_end,
&cached_state);
if (ret) {
mapping_set_error(page->mapping, ret);
end_extent_writepage(page, ret, page_start, page_end);
ClearPageChecked(page);
goto out;
}
ClearPageChecked(page);
set_page_dirty(page);
out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment