|
@@ -1098,12 +1098,14 @@ xfs_ioctl_setattr_dax_invalidate(
|
|
|
/*
|
|
|
* It is only valid to set the DAX flag on regular files and
|
|
|
* directories on filesystems where the block size is equal to the page
|
|
|
- * size. On directories it serves as an inherit hint.
|
|
|
+ * size. On directories it serves as an inherited hint so we don't
|
|
|
+ * have to check the device for dax support or flush pagecache.
|
|
|
*/
|
|
|
if (fa->fsx_xflags & FS_XFLAG_DAX) {
|
|
|
if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)))
|
|
|
return -EINVAL;
|
|
|
- if (!bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
|
|
|
+ if (S_ISREG(inode->i_mode) &&
|
|
|
+ !bdev_dax_supported(xfs_find_bdev_for_inode(VFS_I(ip)),
|
|
|
sb->s_blocksize))
|
|
|
return -EINVAL;
|
|
|
}
|
|
@@ -1114,6 +1116,9 @@ xfs_ioctl_setattr_dax_invalidate(
|
|
|
if (!(fa->fsx_xflags & FS_XFLAG_DAX) && !IS_DAX(inode))
|
|
|
return 0;
|
|
|
|
|
|
+ if (S_ISDIR(inode->i_mode))
|
|
|
+ return 0;
|
|
|
+
|
|
|
/* lock, flush and invalidate mapping in preparation for flag change */
|
|
|
xfs_ilock(ip, XFS_MMAPLOCK_EXCL | XFS_IOLOCK_EXCL);
|
|
|
error = filemap_write_and_wait(inode->i_mapping);
|