@@ -2824,6 +2824,7 @@ static int submit_extent_page(int rw, struct extent_io_tree *tree,
static void attach_extent_buffer_page(struct extent_buffer *eb,
struct page *page)
{
+ BUG_ON(PageSwapCache(page));
if (!PagePrivate(page)) {
SetPagePrivate(page);
page_cache_get(page);
@@ -2835,6 +2836,7 @@ static void attach_extent_buffer_page(struct extent_buffer *eb,
void set_page_extent_mapped(struct page *page)
{
+ BUG_ON(PageSwapCache(page));
if (!PagePrivate(page)) {
SetPagePrivate(page);
page_cache_get(page);
@@ -2903,7 +2905,8 @@ static int __do_readpage(struct extent_io_tree *tree,
size_t blocksize = inode->i_sb->s_blocksize;
unsigned long this_bio_flag = *bio_flags & EXTENT_BIO_PARENT_LOCKED;
- set_page_extent_mapped(page);
+ if (likely(!PageSwapCache(page)))
+ set_page_extent_mapped(page);
end = page_end;
if (!PageUptodate(page)) {
Swapcache pages use ->private to store the swp_entry_t; overwriting it is sure to cause insanity. Signed-off-by: Omar Sandoval <osandov@osandov.com> --- fs/btrfs/extent_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)