提交 ee670f0a 编写于 作者: J Josef Bacik 提交者: Chris Mason

Btrfs: fix btrfs_destroy_marked_extents

So we're forcing the eb's to have their ref count set to 1 so invalidatepage
works but this breaks lots of things, for example root nodes, and is just
plain wrong, we don't need to just evict all of this stuff.  Also drop the
invalidatepage altogether and add a page_cache_release().  With this patch
we no longer hang when trying to access the root nodes after an aborted
transaction and we no longer leak memory.  Thanks,
Signed-off-by: NJosef Bacik <josef@redhat.com>
上级 7b8b92af
...@@ -3524,11 +3524,9 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root, ...@@ -3524,11 +3524,9 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root,
&(&BTRFS_I(page->mapping->host)->io_tree)->buffer, &(&BTRFS_I(page->mapping->host)->io_tree)->buffer,
offset >> PAGE_CACHE_SHIFT); offset >> PAGE_CACHE_SHIFT);
spin_unlock(&dirty_pages->buffer_lock); spin_unlock(&dirty_pages->buffer_lock);
if (eb) { if (eb)
ret = test_and_clear_bit(EXTENT_BUFFER_DIRTY, ret = test_and_clear_bit(EXTENT_BUFFER_DIRTY,
&eb->bflags); &eb->bflags);
atomic_set(&eb->refs, 1);
}
if (PageWriteback(page)) if (PageWriteback(page))
end_page_writeback(page); end_page_writeback(page);
...@@ -3542,8 +3540,8 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root, ...@@ -3542,8 +3540,8 @@ static int btrfs_destroy_marked_extents(struct btrfs_root *root,
spin_unlock_irq(&page->mapping->tree_lock); spin_unlock_irq(&page->mapping->tree_lock);
} }
page->mapping->a_ops->invalidatepage(page, 0);
unlock_page(page); unlock_page(page);
page_cache_release(page);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册