Skip to content

Commit 1e937cd

Browse files
toshikanistellarhopper
authored andcommitted
xfs: 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: Christoph Hellwig <[email protected]> Cc: Dave Chinner <[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 284854b commit 1e937cd

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

fs/xfs/xfs_super.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,14 +1558,12 @@ xfs_fs_fill_super(
15581558

15591559
if (mp->m_flags & XFS_MOUNT_DAX) {
15601560
xfs_warn(mp,
1561-
"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
1562-
if (sb->s_blocksize != PAGE_SIZE) {
1563-
xfs_alert(mp,
1564-
"Filesystem block size invalid for DAX Turning DAX off.");
1565-
mp->m_flags &= ~XFS_MOUNT_DAX;
1566-
} else if (!sb->s_bdev->bd_disk->fops->direct_access) {
1561+
"DAX enabled. Warning: EXPERIMENTAL, use at your own risk");
1562+
1563+
error = bdev_dax_supported(sb, sb->s_blocksize);
1564+
if (error) {
15671565
xfs_alert(mp,
1568-
"Block device does not support DAX Turning DAX off.");
1566+
"DAX unsupported by block device. Turning off DAX.");
15691567
mp->m_flags &= ~XFS_MOUNT_DAX;
15701568
}
15711569
}

0 commit comments

Comments
 (0)