aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2016-05-11 05:58:49 -0400
committerVishal Verma <vishal.l.verma@intel.com>2016-05-17 02:44:07 -0400
commit86b0624e42d03a424e9571b8591d191c436f9af1 (patch)
treea00a6ccf33d6f1880ce18f455d8259dc3dc1a326 /fs/ext2
parent9b6cd5f76d60b563d75e55e432e03ed134761432 (diff)
ext2: Avoid DAX zeroing to corrupt data
Currently ext2 zeroes any data blocks allocated for DAX inode however it still returns them as BH_New. Thus DAX code zeroes them again in dax_insert_mapping() which can possibly overwrite the data that has been already stored to those blocks by a racing dax_io(). Avoid marking pre-zeroed buffers as new. Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com> Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 038d0ed5f565..9a14af3b1a69 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -745,11 +745,11 @@ static int ext2_get_blocks(struct inode *inode,
745 mutex_unlock(&ei->truncate_mutex); 745 mutex_unlock(&ei->truncate_mutex);
746 goto cleanup; 746 goto cleanup;
747 } 747 }
748 } 748 } else
749 set_buffer_new(bh_result);
749 750
750 ext2_splice_branch(inode, iblock, partial, indirect_blks, count); 751 ext2_splice_branch(inode, iblock, partial, indirect_blks, count);
751 mutex_unlock(&ei->truncate_mutex); 752 mutex_unlock(&ei->truncate_mutex);
752 set_buffer_new(bh_result);
753got_it: 753got_it:
754 map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key)); 754 map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
755 if (count > blocks_to_boundary) 755 if (count > blocks_to_boundary)