summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-11-06 19:11:57 +0100
committerMatthew Wilcox <willy@infradead.org>2018-11-16 22:38:49 +0100
commit6d7cd8c1373746a93dc868ee9d38a82df78b38aa (patch)
tree9093681b9b452e62a95805b3e00c2c46eef3d50f
parentXArray tests: Correct some 64-bit assumptions (diff)
downloadlinux-6d7cd8c1373746a93dc868ee9d38a82df78b38aa.tar.xz
linux-6d7cd8c1373746a93dc868ee9d38a82df78b38aa.zip
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: 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>
-rw-r--r--fs/dax.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/fs/dax.c b/fs/dax.c
index 616e36ea6aaa..529ac9d7c10a 100644
--- 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);