Message ID | 20181015154600.13251-1-lhenriques@suse.com (mailing list archive) |
---|---|
Headers | show |
Series | copy_file_range in cephfs kernel client | expand |
Hi, Since it's currently being discussed upstream the removal of the cross device check from copy_file_range (see [1] for details), it may be worth having the check in the patch below added into this patchset (But we can also wait for those VFS changes to be merged first, of course.) The patch below should do the trick, but in the future we could also think about something more elaborate. For example, it shouldn't be too difficult to add the possibility of doing remote copies between 2 different filesystems within the same cluster. (Well, at least doing *full* file copies, but maybe also partial copies.) [1] https://marc.info/?l=linux-fsdevel&m=154058466308234&w=2 Cheers,
> On Oct 28, 2018, at 01:47, Luis Henriques <lhenriques@suse.com> wrote: > > Hi, > > Since it's currently being discussed upstream the removal of the cross > device check from copy_file_range (see [1] for details), it may be worth > having the check in the patch below added into this patchset (But we can > also wait for those VFS changes to be merged first, of course.) > > The patch below should do the trick, but in the future we could also > think about something more elaborate. For example, it shouldn't be too > difficult to add the possibility of doing remote copies between 2 > different filesystems within the same cluster. (Well, at least doing > *full* file copies, but maybe also partial copies.) > > [1] https://marc.info/?l=linux-fsdevel&m=154058466308234&w=2 > > Cheers, > -- > Luis > > diff --git a/fs/ceph/file.c b/fs/ceph/file.c > index b4607baa8969..813d49094ad5 100644 > --- a/fs/ceph/file.c > +++ b/fs/ceph/file.c > @@ -1904,6 +1904,9 @@ static ssize_t ceph_copy_file_range(struct file *src_file, loff_t src_off, > int src_got = 0, dst_got = 0, err, dirty; > bool do_final_copy = false; > > + 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) Applied, thanks Yan, Zheng