Currently this just fails, but the fallback implementation can handle this case. Change it to return -EOPNOTSUPP instead of -EINVAL when copying data to a different spot in the same inode. Cc: Luis Henriques <lhenriques@xxxxxxxx> Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> --- fs/ceph/file.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) NB: with this patch, xfstest generic/075 now passes diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 82af4a3c714d..1b25df9d5853 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -1915,8 +1915,6 @@ static ssize_t ceph_copy_file_range(struct file *src_file, loff_t src_off, if (src_inode->i_sb != dst_inode->i_sb) return -EXDEV; - if (src_inode == dst_inode) - return -EINVAL; if (ceph_snap(dst_inode) != CEPH_NOSNAP) return -EROFS; @@ -1928,6 +1926,10 @@ static ssize_t ceph_copy_file_range(struct file *src_file, loff_t src_off, * efficient). */ + /* Can't do OSD copy op to same object */ + if (src_inode == dst_inode) + return -EOPNOTSUPP; + if (ceph_test_mount_opt(ceph_inode_to_client(src_inode), NOCOPYFROM)) return -EOPNOTSUPP; -- 2.21.0