diff mbox

[-mm,06/25] dax: Split pmd map when fallback on COW

Message ID 20151208013308.25030.16548.stgit@dwillia2-desk3.jf.intel.com (mailing list archive)
State Accepted
Commit 59bf4fb9d386
Headers show

Commit Message

Dan Williams Dec. 8, 2015, 1:33 a.m. UTC
From: Toshi Kani <toshi.kani@hpe.com>

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.

Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox <willy@linux.intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
 fs/dax.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox


diff --git a/fs/dax.c b/fs/dax.c
index 68b04de71d19..88e7b3bfef21 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -578,8 +578,10 @@  int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
 	/* 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);
+	}
 	/* If the PMD would extend outside the VMA */
 	if (pmd_addr < vma->vm_start)