diff options
author | Nikolay Borisov <nborisov@suse.com> | 2017-12-05 09:29:19 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-01-22 16:08:16 +0100 |
commit | f3038ee3a3f1017a1cbe9907e31fa12d366c5dcb (patch) | |
tree | 965740423e5dcb0edbcc9c7bc7bbe882007a8fcc /fs/btrfs/inode.c | |
parent | ad8bc4d005576e3f380ba2dab24c183519f4e9fa (diff) | |
download | lwn-f3038ee3a3f1017a1cbe9907e31fa12d366c5dcb.tar.gz lwn-f3038ee3a3f1017a1cbe9907e31fa12d366c5dcb.zip |
btrfs: Handle btrfs_set_extent_delalloc failure in fixup worker
This function was introduced by 247e743cbe6e ("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.
Cc: stable@vger.kernel.org
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 034d7333b14d..9ad8c9321c8f 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2116,8 +2116,15 @@ again: goto out; } - btrfs_set_extent_delalloc(inode, page_start, page_end, 0, &cached_state, - 0); + ret = btrfs_set_extent_delalloc(inode, page_start, page_end, 0, + &cached_state, 0); + 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); btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); |