diff options
-rw-r--r-- | fs/dax.c | 2 | ||||
-rw-r--r-- | mm/truncate.c | 12 |
2 files changed, 12 insertions, 2 deletions
@@ -1015,7 +1015,7 @@ dax_iomap_actor(struct inode *inode, loff_t pos, loff_t length, void *data, | |||
1015 | * into page tables. We have to tear down these mappings so that data | 1015 | * into page tables. We have to tear down these mappings so that data |
1016 | * written by write(2) is visible in mmap. | 1016 | * written by write(2) is visible in mmap. |
1017 | */ | 1017 | */ |
1018 | if ((iomap->flags & IOMAP_F_NEW) && inode->i_mapping->nrpages) { | 1018 | if (iomap->flags & IOMAP_F_NEW) { |
1019 | invalidate_inode_pages2_range(inode->i_mapping, | 1019 | invalidate_inode_pages2_range(inode->i_mapping, |
1020 | pos >> PAGE_SHIFT, | 1020 | pos >> PAGE_SHIFT, |
1021 | (end - 1) >> PAGE_SHIFT); | 1021 | (end - 1) >> PAGE_SHIFT); |
diff --git a/mm/truncate.c b/mm/truncate.c index 706cff171a15..6479ed2afc53 100644 --- a/mm/truncate.c +++ b/mm/truncate.c | |||
@@ -686,7 +686,17 @@ int invalidate_inode_pages2_range(struct address_space *mapping, | |||
686 | cond_resched(); | 686 | cond_resched(); |
687 | index++; | 687 | index++; |
688 | } | 688 | } |
689 | 689 | /* | |
690 | * For DAX we invalidate page tables after invalidating radix tree. We | ||
691 | * could invalidate page tables while invalidating each entry however | ||
692 | * that would be expensive. And doing range unmapping before doesn't | ||
693 | * work as we have no cheap way to find whether radix tree entry didn't | ||
694 | * get remapped later. | ||
695 | */ | ||
696 | if (dax_mapping(mapping)) { | ||
697 | unmap_mapping_range(mapping, (loff_t)start << PAGE_SHIFT, | ||
698 | (loff_t)(end - start + 1) << PAGE_SHIFT, 0); | ||
699 | } | ||
690 | out: | 700 | out: |
691 | cleancache_invalidate_inode(mapping); | 701 | cleancache_invalidate_inode(mapping); |
692 | return ret; | 702 | return ret; |