Browse Source

Btrfs: Fix page leak in compressed writeback path

"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>
Yan, Zheng 14 years ago
parent
commit
24ae63656a
1 changed files with 1 additions and 1 deletions
  1. 1 1
      fs/btrfs/inode.c

+ 1 - 1
fs/btrfs/inode.c

@@ -495,7 +495,7 @@ again:
 		add_async_extent(async_cow, start, num_bytes,
 		add_async_extent(async_cow, start, num_bytes,
 				 total_compressed, pages, nr_pages_ret);
 				 total_compressed, pages, nr_pages_ret);
 
 
-		if (start + num_bytes < end && start + num_bytes < actual_end) {
+		if (start + num_bytes < end) {
 			start += num_bytes;
 			start += num_bytes;
 			pages = NULL;
 			pages = NULL;
 			cond_resched();
 			cond_resched();