Btrfs: Fix page leak in compressed writeback path
authorYan, Zheng <zheng.z.yan@linux.intel.com>
Mon, 6 Dec 2010 07:02:36 +0000 (07:02 +0000)
committerChris Mason <chris.mason@oracle.com>
Fri, 10 Dec 2010 21:29:09 +0000 (16:29 -0500)
"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>
fs/btrfs/inode.c

index ae6c0d190bc1e75d275894c0a8dc5b22b6489f5e..4875d69871b5a4fedded1c0553420308e886db3b 100644 (file)
@@ -495,7 +495,7 @@ again:
                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();