Commit 6d7cd8c1 authored by Matthew Wilcox's avatar Matthew Wilcox

dax: Remove optimisation from dax_lock_mapping_entry

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: default avatarDan Williams <dan.j.williams@intel.com>
Fixes: 9f32d221 ("dax: Convert dax_lock_mapping_entry to XArray")
Signed-off-by: default avatarMatthew Wilcox <willy@infradead.org>
parent 5404a7f1
...@@ -383,11 +383,8 @@ bool dax_lock_mapping_entry(struct page *page) ...@@ -383,11 +383,8 @@ bool dax_lock_mapping_entry(struct page *page)
entry = xas_load(&xas); entry = xas_load(&xas);
if (dax_is_locked(entry)) { if (dax_is_locked(entry)) {
entry = get_unlocked_entry(&xas); entry = get_unlocked_entry(&xas);
/* Did the page move while we slept? */ xas_unlock_irq(&xas);
if (dax_to_pfn(entry) != page_to_pfn(page)) { continue;
xas_unlock_irq(&xas);
continue;
}
} }
dax_lock_entry(&xas, entry); dax_lock_entry(&xas, entry);
xas_unlock_irq(&xas); xas_unlock_irq(&xas);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment