Re: [PATCH v7 0/4] copy_file_range in cephfs kernel client

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

 



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)



[Index of Archives]     [CEPH Users]     [Ceph Large]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux