Skip to content

Commit

Permalink
dax: Remove optimisation from dax_lock_mapping_entry
Browse files Browse the repository at this point in the history
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 <[email protected]>
Fixes: 9f32d22 ("dax: Convert dax_lock_mapping_entry to XArray")
Signed-off-by: Matthew Wilcox <[email protected]>
  • Loading branch information
Matthew Wilcox committed Nov 16, 2018
1 parent 5404a7f commit 6d7cd8c
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions fs/dax.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6d7cd8c

Please sign in to comment.