dax: Remove optimisation from dax_lock_mapping_entry
authorMatthew Wilcox <willy@infradead.org>
Tue, 6 Nov 2018 18:11:57 +0000 (13:11 -0500)
committerMatthew Wilcox <willy@infradead.org>
Fri, 16 Nov 2018 21:38:49 +0000 (16:38 -0500)
Skipping some of the revalidation after we sleep can lead to returning
a mapping which has already been freed.  Just drop this optimisation.

Reported-by: Dan Williams <dan.j.williams@intel.com>
Fixes: 9f32d221301c ("dax: Convert dax_lock_mapping_entry to XArray")
Signed-off-by: Matthew Wilcox <willy@infradead.org>
fs/dax.c

index 616e36ea6aaab6baf9fd3210aaa425c2398e491b..529ac9d7c10a02af78ca0689fd2dbec7e8d08ce8 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -383,11 +383,8 @@ bool dax_lock_mapping_entry(struct page *page)
                entry = xas_load(&xas);
                if (dax_is_locked(entry)) {
                        entry = get_unlocked_entry(&xas);
-                       /* Did the page move while we slept? */
-                       if (dax_to_pfn(entry) != page_to_pfn(page)) {
-                               xas_unlock_irq(&xas);
-                               continue;
-                       }
+                       xas_unlock_irq(&xas);
+                       continue;
                }
                dax_lock_entry(&xas, entry);
                xas_unlock_irq(&xas);