linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs: Fix page leak in compressed writeback path
@ 2010-12-06  7:02 Yan, Zheng
  0 siblings, 0 replies; only message in thread
From: Yan, Zheng @ 2010-12-06  7:02 UTC (permalink / raw)
  To: linux-btrfs

"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>
---
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8039390..2ea98d8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -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();

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-12-06  7:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-06  7:02 [PATCH] Btrfs: Fix page leak in compressed writeback path Yan, Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).