Skip to content

Commit

Permalink
Btrfs: fix compressed write corruption on enospc
Browse files Browse the repository at this point in the history
When failing to allocate space for the whole compressed extent, we'll
fallback to uncompressed IO, but we've forgotten to redirty the pages
which belong to this compressed extent, and these 'clean' pages will
simply skip 'submit' part and go to endio directly, at last we got data
corruption as we write nothing.

Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Tested-By: Martin Steigerwald <martin@lichtvoll.de>
Signed-off-by: Chris Mason <clm@fb.com>
  • Loading branch information
Liu Bo authored and Chris Mason committed Aug 15, 2014
1 parent f90e579 commit ce62003
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,18 @@ static noinline int submit_compressed_extents(struct inode *inode,
unlock_extent(io_tree, async_extent->start,
async_extent->start +
async_extent->ram_size - 1);

/*
* we need to redirty the pages if we decide to
* fallback to uncompressed IO, otherwise we
* will not submit these pages down to lower
* layers.
*/
extent_range_redirty_for_io(inode,
async_extent->start,
async_extent->start +
async_extent->ram_size - 1);

goto retry;
}
goto out_free;
Expand Down

0 comments on commit ce62003

Please sign in to comment.