Skip to content

Commit 593396b

Browse files
MiaoheLintorvalds
authored andcommitted
mm/memory-failure.c: avoid calling invalidate_inode_page() with unexpected pages
Since commit 042c4f3 ("mm/truncate: Inline invalidate_complete_page() into its one caller"), invalidate_inode_page() can invalidate the pages in the swap cache because the check of page->mapping != mapping is removed. But invalidate_inode_page() is not expected to deal with the pages in swap cache. Also non-lru movable page can reach here too. They're not page cache pages. Skip these pages by checking PageSwapCache and PageLRU. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Miaohe Lin <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Mike Kravetz <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Tony Luck <[email protected]> Cc: Yang Shi <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 888af27 commit 593396b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memory-failure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,7 @@ static int __soft_offline_page(struct page *page)
21842184
return 0;
21852185
}
21862186

2187-
if (!PageHuge(page))
2187+
if (!PageHuge(page) && PageLRU(page) && !PageSwapCache(page))
21882188
/*
21892189
* Try to invalidate first. This should work for
21902190
* non dirty unmapped page cache pages.

0 commit comments

Comments
 (0)