Skip to content

Commit

Permalink
Btrfs: Fix page leak in compressed writeback path
Browse files Browse the repository at this point in the history
"start + num_bytes >= actual_end" can happen when compressed page writeback races
with file truncation. In that case we need unlock and release pages past the end
of file.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Yan, Zheng authored and Chris Mason committed Dec 10, 2010
1 parent 84cd948 commit 24ae636
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ static noinline int compress_file_range(struct inode *inode,
add_async_extent(async_cow, start, num_bytes,
total_compressed, pages, nr_pages_ret);

if (start + num_bytes < end && start + num_bytes < actual_end) {
if (start + num_bytes < end) {
start += num_bytes;
pages = NULL;
cond_resched();
Expand Down

0 comments on commit 24ae636

Please sign in to comment.