summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2016-09-23 10:38:10 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2016-12-16 11:02:54 +0100
commit913b86e92e1f68ab9db00ccb0fecf594732511e5 (patch)
tree5336fd4aef2feec90dc4c5fa25567813b6154332 /fs/read_write.c
parentvfs: no mnt_want_write_file() in vfs_{copy,clone}_file_range() (diff)
downloadlinux-913b86e92e1f68ab9db00ccb0fecf594732511e5.tar.xz
linux-913b86e92e1f68ab9db00ccb0fecf594732511e5.zip
vfs: allow vfs_clone_file_range() across mount points
FICLONE/FICLONERANGE ioctls return -EXDEV if src and dest files are not on the same mount point. Practically, clone only requires that src and dest files are on the same file system. Move the check for same mount point to ioctl handler and keep only the check for same super block in the vfs helper. A following patch is going to use the vfs_clone_file_range() helper in overlayfs to copy up between lower and upper mount points on the same file system. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/read_write.c b/fs/read_write.c
index 3d810a11102c..175d30e3b603 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1655,8 +1655,12 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
struct inode *inode_out = file_inode(file_out);
int ret;
- if (inode_in->i_sb != inode_out->i_sb ||
- file_in->f_path.mnt != file_out->f_path.mnt)
+ /*
+ * FICLONE/FICLONERANGE ioctls enforce that src and dest files are on
+ * the same mount. Practically, they only need to be on the same file
+ * system.
+ */
+ if (inode_in->i_sb != inode_out->i_sb)
return -EXDEV;
if (S_ISDIR(inode_in->i_mode) || S_ISDIR(inode_out->i_mode))