diff options
author | Jan Kara <jack@suse.cz> | 2016-09-27 16:35:45 +0200 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2016-09-27 18:16:55 +0200 |
commit | 225c5161b11838f34464cd1f421b232dbae3b6a0 (patch) | |
tree | ed955d6e3106b0f15341ece6ae0bf82221f6bf16 /fs | |
parent | 5d3ddd84eaefffd23c028bce5610dac8726f71c1 (diff) | |
download | linux-225c5161b11838f34464cd1f421b232dbae3b6a0.tar.bz2 |
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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext2/inode.c | 10 |
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, } if (IS_DAX(inode)) { + int i; + + /* + * We must unmap blocks before zeroing so that writeback cannot + * overwrite zeros with stale data from block device page cache. + */ + for (i = 0; i < count; i++) { + unmap_underlying_metadata(inode->i_sb->s_bdev, + le32_to_cpu(chain[depth-1].key) + i); + } /* * block must be initialised before we put it in the tree * so that it's not found by another thread before it's |