瀏覽代碼

ext2: Fix block zeroing in ext2_get_blocks() for DAX

When zeroing allocated blocks for DAX, we accidentally zeroed only the
first allocated block instead of all of them. So far this problem is
hidden by the fact that page faults always need only a single block and
DAX write code zeroes blocks again. But the zeroing in DAX code is racy
and needs to be removed so fix the zeroing in ext2 to zero all allocated
blocks.

Reported-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>
Jan Kara 9 年之前
父節點
當前提交
9b6cd5f76d
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      fs/ext2/inode.c

+ 1 - 1
fs/ext2/inode.c

@@ -740,7 +740,7 @@ static int ext2_get_blocks(struct inode *inode,
 		err = dax_clear_sectors(inode->i_sb->s_bdev,
 		err = dax_clear_sectors(inode->i_sb->s_bdev,
 				le32_to_cpu(chain[depth-1].key) <<
 				le32_to_cpu(chain[depth-1].key) <<
 				(inode->i_blkbits - 9),
 				(inode->i_blkbits - 9),
-				1 << inode->i_blkbits);
+				count << inode->i_blkbits);
 		if (err) {
 		if (err) {
 			mutex_unlock(&ei->truncate_mutex);
 			mutex_unlock(&ei->truncate_mutex);
 			goto cleanup;
 			goto cleanup;