mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-02 20:59:30 +00:00
dax: Fix sleep in atomic contex in grab_mapping_entry()
Commit642261ac99
: "dax: add struct iomap based DAX PMD support" has introduced unmapping of page tables if huge page needs to be split in grab_mapping_entry(). However the unmapping happens after radix_tree_preload() call which disables preemption and thus unmap_mapping_range() tries to acquire i_mmap_lock in atomic context which is a bug. Fix the problem by moving unmapping before radix_tree_preload() call. Fixes:642261ac99
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
parent
73b92a2a5e
commit
0cb80b4847
15
fs/dax.c
15
fs/dax.c
@ -333,14 +333,6 @@ restart:
|
|||||||
}
|
}
|
||||||
|
|
||||||
spin_unlock_irq(&mapping->tree_lock);
|
spin_unlock_irq(&mapping->tree_lock);
|
||||||
err = radix_tree_preload(
|
|
||||||
mapping_gfp_mask(mapping) & ~__GFP_HIGHMEM);
|
|
||||||
if (err) {
|
|
||||||
if (pmd_downgrade)
|
|
||||||
put_locked_mapping_entry(mapping, index, entry);
|
|
||||||
return ERR_PTR(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Besides huge zero pages the only other thing that gets
|
* Besides huge zero pages the only other thing that gets
|
||||||
* downgraded are empty entries which don't need to be
|
* downgraded are empty entries which don't need to be
|
||||||
@ -350,6 +342,13 @@ restart:
|
|||||||
unmap_mapping_range(mapping,
|
unmap_mapping_range(mapping,
|
||||||
(index << PAGE_SHIFT) & PMD_MASK, PMD_SIZE, 0);
|
(index << PAGE_SHIFT) & PMD_MASK, PMD_SIZE, 0);
|
||||||
|
|
||||||
|
err = radix_tree_preload(
|
||||||
|
mapping_gfp_mask(mapping) & ~__GFP_HIGHMEM);
|
||||||
|
if (err) {
|
||||||
|
if (pmd_downgrade)
|
||||||
|
put_locked_mapping_entry(mapping, index, entry);
|
||||||
|
return ERR_PTR(err);
|
||||||
|
}
|
||||||
spin_lock_irq(&mapping->tree_lock);
|
spin_lock_irq(&mapping->tree_lock);
|
||||||
|
|
||||||
if (pmd_downgrade) {
|
if (pmd_downgrade) {
|
||||||
|
Loading…
Reference in New Issue
Block a user