diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 3315a6eb09a3..b943c9770533 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2254,12 +2254,16 @@ again: mapping_set_error(page->mapping, ret); end_extent_writepage(page, ret, page_start, page_end); ClearPageChecked(page); - goto out; + goto out_reserved; } ClearPageChecked(page); set_page_dirty(page); +out_reserved: btrfs_delalloc_release_extents(BTRFS_I(inode), PAGE_SIZE); + if (ret) + btrfs_delalloc_release_space(inode, data_reserved, page_start, + PAGE_SIZE, true); out: unlock_extent_cached(&BTRFS_I(inode)->io_tree, page_start, page_end, &cached_state);