Commit 98509cfc authored by Chris Mason's avatar Chris Mason

Btrfs: Fix releasepage to properly keep dirty and writeback pages

Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
parent 8d5bf1cb
...@@ -346,7 +346,7 @@ int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, ...@@ -346,7 +346,7 @@ int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS);
found_start = btrfs_header_bytenr(eb); found_start = btrfs_header_bytenr(eb);
if (found_start != start) { if (0 && found_start != start) {
printk("bad tree block start %llu %llu\n", printk("bad tree block start %llu %llu\n",
(unsigned long long)found_start, (unsigned long long)found_start,
(unsigned long long)eb->start); (unsigned long long)eb->start);
...@@ -592,6 +592,9 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags) ...@@ -592,6 +592,9 @@ static int btree_releasepage(struct page *page, gfp_t gfp_flags)
struct extent_map_tree *map; struct extent_map_tree *map;
int ret; int ret;
if (PageWriteback(page) || PageDirty(page))
return 0;
tree = &BTRFS_I(page->mapping->host)->io_tree; tree = &BTRFS_I(page->mapping->host)->io_tree;
map = &BTRFS_I(page->mapping->host)->extent_tree; map = &BTRFS_I(page->mapping->host)->extent_tree;
......
...@@ -3060,6 +3060,8 @@ static int __btrfs_releasepage(struct page *page, gfp_t gfp_flags) ...@@ -3060,6 +3060,8 @@ static int __btrfs_releasepage(struct page *page, gfp_t gfp_flags)
static int btrfs_releasepage(struct page *page, gfp_t gfp_flags) static int btrfs_releasepage(struct page *page, gfp_t gfp_flags)
{ {
if (PageWriteback(page) || PageDirty(page))
return 0;
return __btrfs_releasepage(page, gfp_flags); return __btrfs_releasepage(page, gfp_flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment