Re: [PATCH v6 3/3] xfs: reject removal of realtime flag when datadev doesn't support DAX

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 16, 2018 at 10:04:26AM -0700, Dave Jiang wrote:
> In a situation where the rt_dev is DAX and data_dev is not DAX, if the user
> requests to remove the realtime flag via ioctl we can no longer support DAX
> for that file. Dynamic changing of S_DAX on the inode is not supported due
> to various complications in the existing implementation. Therefore until we
> address the dynamic S_DAX change issues, we must disallow realtime flag
> being removed.
> 
> Signed-off-by: Dave Jiang <dave.jiang@xxxxxxxxx>
> Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> ---
>  fs/xfs/xfs_ioctl.c |   14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> index 2c70a0a4f59f..edd97d527fe8 100644
> --- a/fs/xfs/xfs_ioctl.c
> +++ b/fs/xfs/xfs_ioctl.c
> @@ -1030,6 +1030,20 @@ xfs_ioctl_setattr_xflags(
>  {
>  	struct xfs_mount	*mp = ip->i_mount;
>  	uint64_t		di_flags2;
> +	struct inode		*inode = VFS_I(ip);
> +	struct super_block	*sb = inode->i_sb;
> +
> +	/*
> +	 * In the case that the inode is realtime, and we are trying to remove
> +	 * the realtime flag, and the rtdev supports DAX but the datadev does
> +	 * not support DAX, we can't allow the realtime flag to be removed
> +	 * since we do not support dynamic S_DAX flag removal yet.
> +	 */
> +	if (XFS_IS_REALTIME_INODE(ip) &&
> +	    !(fa->fsx_xflags & FS_XFLAG_REALTIME) &&
> +	    bdev_dax_supported(mp->m_rtdev_targp->bt_bdev, sb->s_blocksize) &&
> +	    !bdev_dax_supported(mp->m_ddev_targp->bt_bdev, sb->s_blocksize))

What happens here if we have a non-rt file that we're trying to turn
into an rt file and the data dev supports dax but not the rt dev?

Changing the rt flag is only supported on files with no data blocks (no
extents, no delalloc blocks), so why can't we remove S_DAX from an empty
file?  There aren't any memory mappings or page cache to get in the way,
correct?

Please fix the complications in the existing implementation that prevent
us from removing S_DAX rather than adding more XFS restrictions, or at
least tell me what's holding that up.

--D

> +		return -ENOTSUPP;
>  
>  	/* Can't change realtime flag if any extents are allocated. */
>  	if ((ip->i_d.di_nextents || ip->i_delayed_blks) &&
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux