aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-09-27 10:35:45 -0400
committerJan Kara <jack@suse.cz>2016-09-27 12:16:55 -0400
commit225c5161b11838f34464cd1f421b232dbae3b6a0 (patch)
treeed955d6e3106b0f15341ece6ae0bf82221f6bf16
parent5d3ddd84eaefffd23c028bce5610dac8726f71c1 (diff)
ext2: Unmap metadata when zeroing blocks
When zeroing blocks for DAX allocations, we also have to unmap aliases in the block device mappings. Otherwise writeback can overwrite zeros with stale data from block device page cache. Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/ext2/inode.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index d5c7d09919f3..303ae2bb269a 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -733,6 +733,16 @@ static int ext2_get_blocks(struct inode *inode,
733 } 733 }
734 734
735 if (IS_DAX(inode)) { 735 if (IS_DAX(inode)) {
736 int i;
737
738 /*
739 * We must unmap blocks before zeroing so that writeback cannot
740 * overwrite zeros with stale data from block device page cache.
741 */
742 for (i = 0; i < count; i++) {
743 unmap_underlying_metadata(inode->i_sb->s_bdev,
744 le32_to_cpu(chain[depth-1].key) + i);
745 }
736 /* 746 /*
737 * block must be initialised before we put it in the tree 747 * block must be initialised before we put it in the tree
738 * so that it's not found by another thread before it's 748 * so that it's not found by another thread before it's