[PATCH 2/4] mm/memory-failure.c: fix wrong user reference report

From: Miaohe Lin
Date: Mon Feb 28 2022 - 09:03:44 EST


The dirty swapcache page is still residing in the swap cache after it's
hwpoisoned. So there is always one extra refcount for swap cache.

Signed-off-by: Miaohe Lin <linmiaohe@xxxxxxxxxx>
---
mm/memory-failure.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 0d7c58340a98..5f9503573263 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -984,7 +984,6 @@ static int me_pagecache_dirty(struct page_state *ps, struct page *p)
static int me_swapcache_dirty(struct page_state *ps, struct page *p)
{
int ret;
- bool extra_pins = false;

ClearPageDirty(p);
/* Trigger EIO in shmem: */
@@ -993,10 +992,7 @@ static int me_swapcache_dirty(struct page_state *ps, struct page *p)
ret = delete_from_lru_cache(p) ? MF_FAILED : MF_DELAYED;
unlock_page(p);

- if (ret == MF_DELAYED)
- extra_pins = true;
-
- if (has_extra_refcount(ps, p, extra_pins))
+ if (has_extra_refcount(ps, p, true))
ret = MF_FAILED;

return ret;
--
2.23.0