xfs: clear reflink flag if setting realtime flag
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 10 Oct 2016 05:49:29 +0000 (16:49 +1100)
committerDave Chinner <david@fromorbit.com>
Mon, 10 Oct 2016 05:49:29 +0000 (16:49 +1100)
Since we can only turn on the rt flag if there are no data extents,
we can safely turn off the reflink flag if the rt flag is being
turned on.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reported-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_ioctl.c

index 8b9f31c54c1ef12728aa7b78637751cd63b6fb3e..598b97bb19da8e70daa33eb5481e90b265552754 100644 (file)
@@ -1034,9 +1034,9 @@ xfs_ioctl_setattr_xflags(
                        return -EINVAL;
        }
 
-       /* Don't allow us to set realtime mode for a reflinked file. */
+       /* Clear reflink if we are actually able to set the rt flag. */
        if ((fa->fsx_xflags & FS_XFLAG_REALTIME) && xfs_is_reflink_inode(ip))
-               return -EINVAL;
+               ip->i_d.di_flags2 &= ~XFS_DIFLAG2_REFLINK;
 
        /* Don't allow us to set DAX mode for a reflinked file for now. */
        if ((fa->fsx_xflags & FS_XFLAG_DAX) && xfs_is_reflink_inode(ip))