@@ -1176,7 +1176,7 @@ xfs_ioctl_setattr_dax_invalidate(
int *join_flags)
{
struct inode *inode = VFS_I(ip);
- int error;
+ int error, flags;
*join_flags = 0;
@@ -1191,8 +1191,10 @@ xfs_ioctl_setattr_dax_invalidate(
if (S_ISDIR(inode->i_mode))
return 0;
+ flags = XFS_MMAPLOCK_EXCL | XFS_IOLOCK_EXCL;
+
/* lock, flush and invalidate mapping in preparation for flag change */
- xfs_ilock(ip, XFS_MMAPLOCK_EXCL | XFS_IOLOCK_EXCL);
+ xfs_ilock(ip, flags);
if ((fa->fsx_xflags & FS_XFLAG_DAX) == FS_XFLAG_DAX &&
!xfs_inode_supports_dax(ip)) {
@@ -1215,11 +1217,11 @@ xfs_ioctl_setattr_dax_invalidate(
if (error)
goto out_unlock;
- *join_flags = XFS_MMAPLOCK_EXCL | XFS_IOLOCK_EXCL;
+ *join_flags = flags;
return 0;
out_unlock:
- xfs_iunlock(ip, XFS_MMAPLOCK_EXCL | XFS_IOLOCK_EXCL);
+ xfs_iunlock(ip, flags);
return error;
}