aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ioctl.c2
-rw-r--r--fs/nfsd/vfs.c3
-rw-r--r--fs/read_write.c3
-rw-r--r--include/linux/fs.h13
4 files changed, 15 insertions, 6 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 6715b7208835..cb9b02940805 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -226,7 +226,7 @@ static long ioctl_file_clone(struct file *dst_file, unsigned long srcfd,
226 ret = -EXDEV; 226 ret = -EXDEV;
227 if (src_file.file->f_path.mnt != dst_file->f_path.mnt) 227 if (src_file.file->f_path.mnt != dst_file->f_path.mnt)
228 goto fdput; 228 goto fdput;
229 ret = vfs_clone_file_range(src_file.file, off, dst_file, destoff, olen); 229 ret = do_clone_file_range(src_file.file, off, dst_file, destoff, olen);
230fdput: 230fdput:
231 fdput(src_file); 231 fdput(src_file);
232 return ret; 232 return ret;
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 8ca642fe9b21..357e844aee84 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -509,8 +509,7 @@ __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp,
509__be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst, 509__be32 nfsd4_clone_file_range(struct file *src, u64 src_pos, struct file *dst,
510 u64 dst_pos, u64 count) 510 u64 dst_pos, u64 count)
511{ 511{
512 return nfserrno(vfs_clone_file_range(src, src_pos, dst, dst_pos, 512 return nfserrno(do_clone_file_range(src, src_pos, dst, dst_pos, count));
513 count));
514} 513}
515 514
516ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst, 515ssize_t nfsd_copy_file_range(struct file *src, u64 src_pos, struct file *dst,
diff --git a/fs/read_write.c b/fs/read_write.c
index 175d30e3b603..c4e206b875d0 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -1687,8 +1687,6 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1687 if (pos_in + len > i_size_read(inode_in)) 1687 if (pos_in + len > i_size_read(inode_in))
1688 return -EINVAL; 1688 return -EINVAL;
1689 1689
1690 sb_start_write(inode_out->i_sb);
1691
1692 ret = file_in->f_op->clone_file_range(file_in, pos_in, 1690 ret = file_in->f_op->clone_file_range(file_in, pos_in,
1693 file_out, pos_out, len); 1691 file_out, pos_out, len);
1694 if (!ret) { 1692 if (!ret) {
@@ -1696,7 +1694,6 @@ int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1696 fsnotify_modify(file_out); 1694 fsnotify_modify(file_out);
1697 } 1695 }
1698 1696
1699 sb_end_write(inode_out->i_sb);
1700 return ret; 1697 return ret;
1701} 1698}
1702EXPORT_SYMBOL(vfs_clone_file_range); 1699EXPORT_SYMBOL(vfs_clone_file_range);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index dc0478c07b2a..52663f1f3084 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1783,6 +1783,19 @@ extern int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
1783extern int vfs_dedupe_file_range(struct file *file, 1783extern int vfs_dedupe_file_range(struct file *file,
1784 struct file_dedupe_range *same); 1784 struct file_dedupe_range *same);
1785 1785
1786static inline int do_clone_file_range(struct file *file_in, loff_t pos_in,
1787 struct file *file_out, loff_t pos_out,
1788 u64 len)
1789{
1790 int ret;
1791
1792 sb_start_write(file_inode(file_out)->i_sb);
1793 ret = vfs_clone_file_range(file_in, pos_in, file_out, pos_out, len);
1794 sb_end_write(file_inode(file_out)->i_sb);
1795
1796 return ret;
1797}
1798
1786struct super_operations { 1799struct super_operations {
1787 struct inode *(*alloc_inode)(struct super_block *sb); 1800 struct inode *(*alloc_inode)(struct super_block *sb);
1788 void (*destroy_inode)(struct inode *); 1801 void (*destroy_inode)(struct inode *);