From: Darrick J. Wong Date: Mon, 10 Oct 2016 05:49:29 +0000 (+1100) Subject: xfs: clear reflink flag if setting realtime flag X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1987fd743415564e8c67f2f7ec0ae3c18a6b11cd;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git xfs: clear reflink flag if setting realtime flag 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 Reported-by: Brian Foster Reviewed-by: Dave Chinner Signed-off-by: Dave Chinner --- diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 8b9f31c54c1e..598b97bb19da 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -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))