提交 225c5161 编写于 作者: J Jan Kara

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: NJan Kara <jack@suse.cz>
上级 5d3ddd84
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册