summaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>2015-09-08 17:59:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-09-08 18:35:28 -0400
commit46c043ede4711e8d598b9d63c5616c1fedb0605e (patch)
tree8a559930980f59ef24c25b73b91899106f8f0418 /mm/memory.c
parent3fdd1b479dbc03347e98f904f54133a9cef5521f (diff)
mm: take i_mmap_lock in unmap_mapping_range() for DAX
DAX is not so special: we need i_mmap_lock to protect mapping->i_mmap. __dax_pmd_fault() uses unmap_mapping_range() shoot out zero page from all mappings. We need to drop i_mmap_lock there to avoid lock deadlock. Re-aquiring the lock should be fine since we check i_size after the point. Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Cc: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 320c42e95e69..ce8e983f3c4d 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2426,17 +2426,10 @@ void unmap_mapping_range(struct address_space *mapping,
2426 if (details.last_index < details.first_index) 2426 if (details.last_index < details.first_index)
2427 details.last_index = ULONG_MAX; 2427 details.last_index = ULONG_MAX;
2428 2428
2429 2429 i_mmap_lock_write(mapping);
2430 /*
2431 * DAX already holds i_mmap_lock to serialise file truncate vs
2432 * page fault and page fault vs page fault.
2433 */
2434 if (!IS_DAX(mapping->host))
2435 i_mmap_lock_write(mapping);
2436 if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap))) 2430 if (unlikely(!RB_EMPTY_ROOT(&mapping->i_mmap)))
2437 unmap_mapping_range_tree(&mapping->i_mmap, &details); 2431 unmap_mapping_range_tree(&mapping->i_mmap, &details);
2438 if (!IS_DAX(mapping->host)) 2432 i_mmap_unlock_write(mapping);
2439 i_mmap_unlock_write(mapping);
2440} 2433}
2441EXPORT_SYMBOL(unmap_mapping_range); 2434EXPORT_SYMBOL(unmap_mapping_range);
2442 2435