Merge tag 'mm-hotfixes-stable-2023-03-04-13-12' of git://git.kernel.org/pub/scm/linux...
[sfrench/cifs-2.6.git] / mm / memory-failure.c
index a1ede7bdce95e89adae2bb9664a54dce708fc419..fae9baf3be1622991bc13842c797255fa46462b7 100644 (file)
@@ -1069,7 +1069,7 @@ static int me_pagecache_dirty(struct page_state *ps, struct page *p)
  * cache and swap cache(ie. page is freshly swapped in). So it could be
  * referenced concurrently by 2 types of PTEs:
  * normal PTEs and swap PTEs. We try to handle them consistently by calling
- * try_to_unmap(TTU_IGNORE_HWPOISON) to convert the normal PTEs to swap PTEs,
+ * try_to_unmap(!TTU_HWPOISON) to convert the normal PTEs to swap PTEs,
  * and then
  *      - clear dirty bit to prevent IO
  *      - remove from LRU
@@ -1486,7 +1486,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
                                  int flags, struct page *hpage)
 {
        struct folio *folio = page_folio(hpage);
-       enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC;
+       enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC | TTU_HWPOISON;
        struct address_space *mapping;
        LIST_HEAD(tokill);
        bool unmap_success;
@@ -1516,7 +1516,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
 
        if (PageSwapCache(p)) {
                pr_err("%#lx: keeping poisoned page in swap cache\n", pfn);
-               ttu |= TTU_IGNORE_HWPOISON;
+               ttu &= ~TTU_HWPOISON;
        }
 
        /*
@@ -1531,7 +1531,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
                if (page_mkclean(hpage)) {
                        SetPageDirty(hpage);
                } else {
-                       ttu |= TTU_IGNORE_HWPOISON;
+                       ttu &= ~TTU_HWPOISON;
                        pr_info("%#lx: corrupted page was clean: dropped without side effects\n",
                                pfn);
                }