diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-11-06 13:11:57 -0500 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-11-16 16:38:49 -0500 |
commit | 6d7cd8c1373746a93dc868ee9d38a82df78b38aa (patch) | |
tree | 9093681b9b452e62a95805b3e00c2c46eef3d50f | |
parent | 5404a7f1c21cfda061712bedf2d06cc0f6c755e9 (diff) |
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.c | 7 |
1 files changed, 2 insertions, 5 deletions
@@ -383,11 +383,8 @@ bool dax_lock_mapping_entry(struct page *page) | |||
383 | entry = xas_load(&xas); | 383 | entry = xas_load(&xas); |
384 | if (dax_is_locked(entry)) { | 384 | if (dax_is_locked(entry)) { |
385 | entry = get_unlocked_entry(&xas); | 385 | entry = get_unlocked_entry(&xas); |
386 | /* Did the page move while we slept? */ | 386 | xas_unlock_irq(&xas); |
387 | if (dax_to_pfn(entry) != page_to_pfn(page)) { | 387 | continue; |
388 | xas_unlock_irq(&xas); | ||
389 | continue; | ||
390 | } | ||
391 | } | 388 | } |
392 | dax_lock_entry(&xas, entry); | 389 | dax_lock_entry(&xas, entry); |
393 | xas_unlock_irq(&xas); | 390 | xas_unlock_irq(&xas); |