Skip to content

Commit 284854b

Browse files
toshikanistellarhopper
authored andcommitted
ext2: Add alignment check for DAX mount
When a partition is not aligned by 4KB, mount -o dax succeeds, but any read/write access to the filesystem fails, except for metadata update. Call bdev_dax_supported() to perform proper precondition checks which includes this partition alignment check. Signed-off-by: Toshi Kani <[email protected]> Reviewed-by: Jan Kara <[email protected]> Cc: Jan Kara <[email protected]> Cc: Dan Williams <[email protected]> Cc: Ross Zwisler <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Boaz Harrosh <[email protected]> Signed-off-by: Vishal Verma <[email protected]>
1 parent 87eefeb commit 284854b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

fs/ext2/super.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -922,16 +922,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
922922
blocksize = BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
923923

924924
if (sbi->s_mount_opt & EXT2_MOUNT_DAX) {
925-
if (blocksize != PAGE_SIZE) {
926-
ext2_msg(sb, KERN_ERR,
927-
"error: unsupported blocksize for dax");
925+
err = bdev_dax_supported(sb, blocksize);
926+
if (err)
928927
goto failed_mount;
929-
}
930-
if (!sb->s_bdev->bd_disk->fops->direct_access) {
931-
ext2_msg(sb, KERN_ERR,
932-
"error: device does not support dax");
933-
goto failed_mount;
934-
}
935928
}
936929

937930
/* If the blocksize doesn't match, re-read the thing.. */

0 commit comments

Comments
 (0)