xfs: fix the dax supported check in xfs_ioctl_setattr_dax_invalidate
authorChristoph Hellwig <hch@lst.de>
Fri, 30 Aug 2019 15:56:55 +0000 (08:56 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Sat, 31 Aug 2019 05:43:58 +0000 (22:43 -0700)
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>
fs/xfs/xfs_ioctl.c

index 495565f..9a6823e 100644 (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;
        }