Merge tag 'fuse-update-5.14' of git://git.kernel.org/pub/scm/linux/kernel/git/mszered...
[linux-2.6-microblaze.git] / mm / memory-failure.c
index 9d2d31f..eefd823 100644 (file)
@@ -1266,10 +1266,10 @@ static int get_hwpoison_page(struct page *p, unsigned long flags)
 static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
                                  int flags, struct page **hpagep)
 {
-       enum ttu_flags ttu = TTU_IGNORE_MLOCK;
+       enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC;
        struct address_space *mapping;
        LIST_HEAD(tokill);
-       bool unmap_success = true;
+       bool unmap_success;
        int kill = 1, forcekill;
        struct page *hpage = *hpagep;
        bool mlocked = PageMlocked(hpage);
@@ -1332,7 +1332,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
                collect_procs(hpage, &tokill, flags & MF_ACTION_REQUIRED);
 
        if (!PageHuge(hpage)) {
-               unmap_success = try_to_unmap(hpage, ttu);
+               try_to_unmap(hpage, ttu);
        } else {
                if (!PageAnon(hpage)) {
                        /*
@@ -1340,21 +1340,20 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
                         * could potentially call huge_pmd_unshare.  Because of
                         * this, take semaphore in write mode here and set
                         * TTU_RMAP_LOCKED to indicate we have taken the lock
-                        * at this higer level.
+                        * at this higher level.
                         */
                        mapping = hugetlb_page_mapping_lock_write(hpage);
                        if (mapping) {
-                               unmap_success = try_to_unmap(hpage,
-                                                    ttu|TTU_RMAP_LOCKED);
+                               try_to_unmap(hpage, ttu|TTU_RMAP_LOCKED);
                                i_mmap_unlock_write(mapping);
-                       } else {
+                       } else
                                pr_info("Memory failure: %#lx: could not lock mapping for mapped huge page\n", pfn);
-                               unmap_success = false;
-                       }
                } else {
-                       unmap_success = try_to_unmap(hpage, ttu);
+                       try_to_unmap(hpage, ttu);
                }
        }
+
+       unmap_success = !page_mapped(hpage);
        if (!unmap_success)
                pr_err("Memory failure: %#lx: failed to unmap page (mapcount=%d)\n",
                       pfn, page_mapcount(hpage));