Today, xfs_reflink_remap_prep() will reject inodes which are in the CPU direct access state, i.e. IS_DAX() is true. However, it is possible to have inodes with the XFS_DIFLAG2_DAX set, but which are not activated as dax, due to the dax=never mount option, or due to the flag being set after the inode was loaded. To avoid confusion and make the lack of dax+reflink crystal clear for the user, reject reflink requests for both IS_DAX and XFS_DIFLAG2_DAX inodes. Signed-off-by: Eric Sandeen <sandeen@xxxxxxxxxx> --- This is RFC because as Darrick says, it introduces a new failure mode for reflink. On the flip side, today the user can reflink a chattr +x'd file, but cannot chattr +x a reflinked file, which seems a best a bit asymmetrical and confusing... see xfs_ioctl_setattr_xflags() fs/xfs/xfs_reflink.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 6fa05fb78189..b69dbb992b0c 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -1308,6 +1308,11 @@ xfs_reflink_remap_prep( if (IS_DAX(inode_in) || IS_DAX(inode_out)) goto out_unlock; + /* Until we have dax+reflink don't even allow the flags to co-exist */ + if (src->i_d.di_flags2 & XFS_DIFLAG2_DAX || + dest->i_d.di_flags2 & XFS_DIFLAG2_DAX) + goto out_unlock; + ret = generic_remap_file_range_prep(file_in, pos_in, file_out, pos_out, len, remap_flags); if (ret || *len == 0) -- 2.17.0