]> Git Repo - linux.git/commitdiff
dax: Split pmd map when fallback on COW
authorToshi Kani <[email protected]>
Sat, 16 Jan 2016 00:56:05 +0000 (16:56 -0800)
committerLinus Torvalds <[email protected]>
Sat, 16 Jan 2016 01:56:32 +0000 (17:56 -0800)
An infinite loop of PMD faults was observed when attempted to mlock() a
private read-only PMD mmap'd range of a DAX file.

__dax_pmd_fault() simply returns with VM_FAULT_FALLBACK when falling
back to PTE on COW.  However, __handle_mm_fault() returns without
falling back to handle_pte_fault() because a PMD map is present in this
case.

Change __dax_pmd_fault() to split the PMD map, if present, before
returning with VM_FAULT_FALLBACK.

Signed-off-by: Toshi Kani <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Cc: Kirill A. Shutemov <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Cc: Ross Zwisler <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/dax.c

index 5c548d821a2a67835891e91a0606154fca2648e3..3220da70ee2072679dee6f72309bdb4a3c1829a1 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -578,8 +578,10 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
                return VM_FAULT_FALLBACK;
 
        /* Fall back to PTEs if we're going to COW */
-       if (write && !(vma->vm_flags & VM_SHARED))
+       if (write && !(vma->vm_flags & VM_SHARED)) {
+               split_huge_pmd(vma, pmd, address);
                return VM_FAULT_FALLBACK;
+       }
        /* If the PMD would extend outside the VMA */
        if (pmd_addr < vma->vm_start)
                return VM_FAULT_FALLBACK;
This page took 0.051475 seconds and 4 git commands to generate.