xfs: fix the dax supported check in xfs_ioctl_setattr_dax_invalidate

Setting the DAX flag on the directory of a file system that is not on a
DAX capable device makes as little sense as setting it on a regular file
on the same file system.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
This commit is contained in:
Christoph Hellwig 2019-08-30 08:56:55 -07:00 committed by Darrick J. Wong
parent 40144e49ff
commit adcb0ca233
1 changed files with 1 additions and 2 deletions

View File

@ -1309,8 +1309,7 @@ xfs_ioctl_setattr_dax_invalidate(
if (fa->fsx_xflags & FS_XFLAG_DAX) {
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
return -EINVAL;
if (S_ISREG(inode->i_mode) &&
!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
if (!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
sb->s_blocksize))
return -EINVAL;
}