Skip to content

Commit 87eefeb

Browse files
toshikanistellarhopper
authored andcommitted
ext4: 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. Reported-by: Micah Parrish <[email protected]> Signed-off-by: Toshi Kani <[email protected]> Reviewed-by: Jan Kara <[email protected]> Cc: "Theodore Ts'o" <[email protected]> Cc: Andreas Dilger <[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 2d96afc commit 87eefeb

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

fs/ext4/super.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3417,16 +3417,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
34173417
}
34183418

34193419
if (sbi->s_mount_opt & EXT4_MOUNT_DAX) {
3420-
if (blocksize != PAGE_SIZE) {
3421-
ext4_msg(sb, KERN_ERR,
3422-
"error: unsupported blocksize for dax");
3423-
goto failed_mount;
3424-
}
3425-
if (!sb->s_bdev->bd_disk->fops->direct_access) {
3426-
ext4_msg(sb, KERN_ERR,
3427-
"error: device does not support dax");
3420+
err = bdev_dax_supported(sb, blocksize);
3421+
if (err)
34283422
goto failed_mount;
3429-
}
34303423
}
34313424

34323425
if (ext4_has_feature_encrypt(sb) && es->s_encryption_level) {

0 commit comments

Comments
 (0)