dax: ensure that zero pages are removed from other processes
[firefly-linux-kernel-4.4.55.git] / fs / dax.c
index d778e5f1a01cf3ff76e4f222f43bed90bf5d2774..74838c43be91088d2022e322bbce1a02c00bbe06 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -568,7 +568,11 @@ int __dax_pmd_fault(struct vm_area_struct *vma, unsigned long address,
        if ((pgoff | PG_PMD_COLOUR) >= size)
                goto fallback;
 
-       if (is_huge_zero_pmd(*pmd))
+       /*
+        * If we allocated new storage, make sure no process has any
+        * zero pages covering this hole
+        */
+       if (buffer_new(&bh))
                unmap_mapping_range(mapping, pgoff << PAGE_SHIFT, PMD_SIZE, 0);
 
        if (!write && !buffer_mapped(&bh) && buffer_uptodate(&bh)) {