mm/memory-failure.c: avoid calling invalidate_inode_page() with unexpected pages
authorMiaohe Lin <linmiaohe@huawei.com>
Mon, 28 Feb 2022 23:01:16 +0000 (10:01 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 28 Feb 2022 23:01:16 +0000 (10:01 +1100)
commitf0d969325f64a2466e20df44d16ec05fbbdef77e
treeb065f2851b6070fd151c87cca0bd9148caf26fbe
parentc040b64d184fe84910ab04260f4d29b6f1b7f6cd
mm/memory-failure.c: avoid calling invalidate_inode_page() with unexpected pages

Since commit 042c4f32323b ("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/20220228140245.24552-4-linmiaohe@huawei.com
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/memory-failure.c